PlatformID 열거형

정의

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

public enum class PlatformID
public enum PlatformID
[System.Serializable]
public enum PlatformID
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum PlatformID
type PlatformID = 
[<System.Serializable>]
type PlatformID = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PlatformID = 
Public Enum PlatformID
상속
PlatformID
특성

필드

MacOSX 6

운영 체제가 Macintosh입니다. 이 값은 Silverlight에서 반환되었습니다. .NET Core에서 대체 항목은 Unix입니다.

Other 7

기타 운영 체제입니다. 여기에는 Browser(WASM)가 포함됩니다.

Unix 4

운영 체제가 Unix입니다.

Win32NT 2

운영 체제가 Windows NT 이상입니다.

Win32S 0

운영 체제가 Win32입니다. 이 값은 더 이상 사용되지 않습니다.

Win32Windows 1

운영 체제가 Windows 95 또는 Windows 98입니다. 이 값은 더 이상 사용되지 않습니다.

WinCE 3

운영 체제가 Windows CE입니다. 이 값은 더 이상 사용되지 않습니다.

Xbox 5

개발 플랫폼이 Xbox 360입니다. 이 값은 더 이상 사용되지 않습니다.

예제

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

// 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.
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.
open System

let msg1 = "This is a Windows operating system."
let msg2 = "This is a Unix operating system."
let msg3 = "ERROR: This platform identifier is invalid."

// Assume this example is run on a Windows operating system.
let os = Environment.OSVersion
let pid = os.Platform
match pid with
| PlatformID.Win32NT
| PlatformID.Win32S
| PlatformID.Win32Windows
| PlatformID.WinCE ->
    printfn $"{msg1}"
| PlatformID.Unix ->
    printfn $"{msg2}"
| _ ->
    printfn $"{msg3}"
// This example produces the following results:
//     This is a Windows operating system.
' This example demonstrates the PlatformID enumeration.
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
End Class
'
'This example produces the following results:
'
'This is a Windows operating system.
'

설명

Environment.OSVersionOperatingSystem.Platform 속성을 사용하여 현재 실행 중인 운영 체제 또는 개발 플랫폼에 대한 열거형을 가져옵니다PlatformID. 사용 된 PlatformID 현재 운영 체제 또는 개발 플랫폼 애플리케이션을 지원 하는지 여부를 결정 하는 열거형입니다.

PlatformID 열거형 멤버의 기본 정수 값을 SignTool.exe(서명 도구) 유틸리티의 인수로 PlatformId 사용할 수 있습니다.

적용 대상