PlatformID Enumeration
.NET Framework 3.0
Identifies the operating system, or platform, supported by an assembly.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
| Member name | Description | |
|---|---|---|
| Unix | The operating system is Unix. | |
![]() | Win32NT | The operating system is Windows NT or later. |
![]() | 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. |
![]() | WinCE | The operating system is Windows CE. |
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.
The following example demonstrates using the PlatformID class to identify the currently executing operating system.
// This example demonstrates the PlatformID enumeration. using namespace System; int main() { String^ msg1 = L"This is a Windows operating system."; String^ msg2 = L"This is a Unix operating system."; String^ msg3 = L"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; } return 1; } /* This example produces the following results: This is a Windows operating system. */
// This example demonstrates the PlatformID enumeration.
import System.*;
class Sample
{
public static void main(String[] args)
{
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.get_OSVersion();
PlatformID pid = os.get_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;
}
} //main
} //Sample
/*
This example produces the following results:
This is a Windows operating system.
*/
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show:
