PlatformID Enumeration
Identifies the operating system, or platform, supported by an assembly.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
| 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 Windows 98. |
![]() | 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. |
Use the Environment.OSVersion and OperatingSystem.Platform properties to obtain the PlatformID enumeration for the currently executing operating system or development platform. Use the PlatformID enumeration to help determine whether the current operating system or development platform supports your application.
You can use the underlying integer value of each PlatformID enumeration member, as shown in the table, as the PlatformId argument for the SignTool.exe (Sign Tool) utility.
Member | Underlying value |
|---|---|
Win32S | 0 |
Win32Windows | 1 |
Win32NT | 2 |
WinCE | 3 |
Unix | 4 |
Xbox | 5 |
MacOSX | 6 |
The following example demonstrates using the PlatformID class to identify the currently executing operating system.
// This example demonstrates the PlatformID enumeration. using System; class Sample { public static void Main() { string msg1 = "This is a Windows operating system."; string msg2 = "This is a Unix operating system."; string msg3 = "ERROR: This platform identifier is invalid."; // Assume this example is run on a Windows operating system. OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; switch (pid) { case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: Console.WriteLine(msg1); break; case PlatformID.Unix: Console.WriteLine(msg2); break; default: Console.WriteLine(msg3); break; } } } /* This example produces the following results: This is a Windows operating system. */
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
