PlatformID Enum
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Identificeert het besturingssysteem of het platform dat wordt ondersteund door een assembly.
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
- Overname
- Kenmerken
Velden
| Name | Waarde | Description |
|---|---|---|
| Win32S | 0 | Het besturingssysteem is Win32s. Deze waarde wordt niet meer gebruikt. |
| Win32Windows | 1 | Het besturingssysteem is Windows 95 of Windows 98. Deze waarde wordt niet meer gebruikt. |
| Win32NT | 2 | Het besturingssysteem is Windows NT of hoger. |
| WinCE | 3 | Het besturingssysteem is Windows CE. Deze waarde wordt niet meer gebruikt. |
| Unix | 4 | Het besturingssysteem is Unix. |
| Xbox | 5 | Het ontwikkelplatform is Xbox 360. Deze waarde wordt niet meer gebruikt. |
| MacOSX | 6 | Het besturingssysteem is Macintosh. Deze waarde is geretourneerd door Silverlight. Op .NET Core wordt de vervanging |
| Other | 7 | Elk ander besturingssysteem. Dit omvat Browser (WASM). |
Voorbeelden
In het volgende voorbeeld ziet u hoe u de PlatformID klasse gebruikt om het momenteel uitgevoerde besturingssysteem te identificeren:
// 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.
'
Opmerkingen
Gebruik de Environment.OSVersion en OperatingSystem.Platform eigenschappen om de PlatformID opsomming te verkrijgen voor het momenteel uitgevoerde besturingssysteem of ontwikkelplatform. Gebruik de PlatformID opsomming om te bepalen of het huidige besturingssysteem of ontwikkelplatform uw toepassing ondersteunt.
U kunt de onderliggende geheel getalwaarde van elk PlatformID opsommingslid gebruiken als het PlatformId argument voor het hulpprogramma SignTool.exe (Hulpprogramma voor ondertekenen ).