다음을 통해 공유


PlatformID 열거형

어셈블리에서 지원하는 운영 체제 또는 플랫폼을 식별합니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration PlatformID
‘사용 방법
Dim instance As PlatformID
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum PlatformID
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class PlatformID
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum PlatformID
SerializableAttribute 
ComVisibleAttribute(true) 
public enum PlatformID

멤버

  멤버 이름 설명
Unix 운영 체제가 Unix입니다. 
Supported by the .NET Compact Framework Win32NT 운영 체제가 Windows NT 이상입니다. 
Supported by the .NET Compact Framework Win32S 운영 체제가 Win32입니다. Win32는 32비트 응용 프로그램에 액세스할 수 있도록 16비트 버전의 Windows에서 실행되는 계층입니다. 
Supported by the .NET Compact Framework Win32Windows 운영 체제가 Windows 95 이상입니다. 
Supported by the .NET Compact Framework WinCE 운영 체제가 Windows CE입니다. 

설명

Environment.OSVersionOperatingSystem.Platform 속성을 사용하여 현재 실행 중인 운영 체제에 대한 PlatformID 열거형을 구합니다. PlatformID 열거형을 사용하여 현재 운영 체제에서 응용 프로그램을 지원하는지 여부를 쉽게 확인할 수 있습니다.

예제

다음 예제에서는 PlatformID 클래스를 사용하여 현재 실행 중인 운영 체제를 식별하는 방법을 보여 줍니다.

' This example demonstrates the PlatformID enumeration.
Imports System

Class Sample
   Public Shared Sub Main()
      Dim msg1 As String = "This is a Windows operating system."
      Dim msg2 As String = "This is a Unix operating system."
      Dim msg3 As String = "ERROR: This platform identifier is invalid."
      
      ' Assume this example is run on a Windows operating system.
      Dim os As OperatingSystem = Environment.OSVersion
      Dim pid As PlatformID = os.Platform
      Select Case pid
         Case PlatformID.Win32NT, PlatformID.Win32S, _
              PlatformID.Win32Windows, PlatformID.WinCE
            Console.WriteLine(msg1)
         Case PlatformID.Unix
            Console.WriteLine(msg2)
         Case Else
            Console.WriteLine(msg3)
      End Select
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'This is a Windows 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.
*/
// 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 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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

System 네임스페이스