If you use a wrapper library like Code Pack (http://code.msdn.microsoft.com/WindowsAPICodePack ) it does the version checking for you. You go ahead and call the library methods and it will throw a PlatformNotSupportedException if you try something that's not on the OS when you're runnning.
You can also catch EntryPointNotFoundException if you're P/Invoking into some Windows DLL. This is the best approach when doing your own interop, because functionality may get added (by updates and service packs) years from now into downlevel OS.
With both of these, you can cache some sort of flag that reminds you there is no taskbar or there are no libraries or you don't have whatever features, so as to save the perf hit of throwing and catching the exception.
If you insist on doing your own version checking and seeing what OS you are on, please remember the magic of >=. You know how much code is out there that tests the version is exactly XP SP2 and then puts up a message box saying "Requires XP SP2 or later"? A ton. In fact, that's why the major version for Win7 is 6 -- so that all the code checking for "equal to 6" would still work. Don't be that guy.
if (Environment.OSVersion.Version.Major >= 6)
{
if (Environment.OSVersion.Version.Minor >= 1)
// Do Win7 thing
else
// Do Vista thing
}
else if (Environment.OSVersion.Version.Major >= 5)
// Do XP thing
You can find all the major/minor numbers at http://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx
Kate