To determine the operating system service pack and some information about the operating system i first read and then i search is there any other way in the managed code to do so without using the window API. Then i come across the following finding.
The System.Environment class contain the OSversion property which contain the following operating system related information. The Platform, ServicePack, Version and the VersionString properties are expose to get those information.
Console.WriteLine("PlatformID : "+Environment.OSVersion.Platform);
Console.WriteLine("Service Pack: "+Environment.OSVersion.ServicePack);
Console.WriteLine("Version: "+Environment.OSVersion.Version);
Console.WriteLine("Version String: "+Environment.OSVersion.VersionString);
The Environment.OSVersion.Platform property return the PlatformID enumeration to help determine whether the current operating system or development platform supports your application. Here is the list of the PlatformID named constant.
Member Name | Description |
---|---|
Win32S | The operating system is Win32s. Win32s is a layer that runs on 16-bit versions of Windows to provide access to 32-bit applications. |
Win32Windows | The operating system is Windows 95 or later. |
Win32NT | The operating system is Windows NT or later. |
WinCE | The operating system is Windows CE. |
Unix | The operating system is Unix. |
Xbox | The development platform is Xbox 360. |
MacOSX | The operating system is Macintosh. |
No comments:
Post a Comment