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
属性

フィールド

名前 説明
Win32S 0

オペレーティング システムは Win32s です。 この値は使用されなくなりました。

Win32Windows 1

オペレーティング システムは、Windows 95 または Windows 98 です。 この値は使用されなくなりました。

Win32NT 2

オペレーティング システムが NT 以降Windows。

WinCE 3

オペレーティング システムが CE Windows。 この値は使用されなくなりました。

Unix 4

オペレーティング システムは Unix です。

Xbox 5

開発プラットフォームはXbox 360 です。 この値は使用されなくなりました。

MacOSX 6

オペレーティング システムは Macintosh です。 この値は Silverlight によって返されました。 .NET Core では、その置換は Unix です。

Other 7

その他のオペレーティング システム。 これには Browser (WASM) が含まれます。

次の例は、 PlatformID クラスを使用して現在実行中のオペレーティング システムを識別する方法を示しています。

// 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.OSVersionプロパティとOperatingSystem.Platformプロパティを使用して、現在実行中のオペレーティング システムまたは開発プラットフォームのPlatformID列挙体を取得します。 現在のオペレーティング システムまたは開発プラットフォームがアプリケーションをサポートしているかどうかを判断するには、 PlatformID 列挙体を使用します。

SignTool.exe PlatformID ユーティリティのPlatformId引数として、各列挙メンバーの基になる整数値を使用できます。

適用対象