This example simply gets the System.Environment.OSVersion object and displays its VersionString property.
The OperatingSystem object has some other properties that may be useful in some programs.
Platform - Get a platform enumeration that can be one of Win32S (a Win32 layer in 16-bit windows), Win32Windows (Win95 or Win98), Win32NT WinNT or later), WinCE, Unix, or Xbox.
ServicePack - The service pack number as in "Service Pack 2."
Version - The operating system version numbers. This property includes the sub-properties Build, Major, MajorRevision, Minor, and MinorRevision.
You can translate the platform ID, major version, and minor version into the operating system (see How to determine the Windows version by using Visual C# for information) but it's a big hassle. It's much easier to just use the VersionString if you can.
Comments