PlatformID Sabit listesi
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Bir derleme tarafından desteklenen işletim sistemini veya platformu tanımlar.
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
- Devralma
- Öznitelikler
Alanlar
| Name | Değer | Description |
|---|---|---|
| Win32S | 0 | İşletim sistemi Win32s'dir. Bu değer artık kullanımda değil. |
| Win32Windows | 1 | İşletim sistemi 95 veya Windows 98 Windows. Bu değer artık kullanımda değil. |
| Win32NT | 2 | İşletim sistemi NT veya sonraki Windows. |
| WinCE | 3 | İşletim sistemi CE Windows. Bu değer artık kullanımda değil. |
| Unix | 4 | İşletim sistemi Unix'tir. |
| Xbox | 5 | Geliştirme platformu 360 Xbox. Bu değer artık kullanımda değil. |
| MacOSX | 6 | İşletim sistemi Macintosh'tır. Bu değer Silverlight tarafından döndürüldü. .NET Core'da yerini |
| Other | 7 | Diğer tüm işletim sistemleri. Buna Tarayıcı (WASM) dahildir. |
Örnekler
Aşağıdaki örnekte, şu anda yürütülen işletim sistemini tanımlamak için sınıfının kullanılması PlatformID gösterilmektedir:
// 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.
'
Açıklamalar
Environment.OSVersion Şu anda yürütülen işletim sistemi veya geliştirme platformu için numaralandırmayı almak OperatingSystem.Platform için ve PlatformID özelliklerini kullanın.
PlatformID Geçerli işletim sisteminin veya geliştirme platformunun uygulamanızı destekleyip desteklemediğini saptamaya yardımcı olması için numaralandırmayı kullanın.
PlatformID yardımcı programı için bağımsız değişken olarak her PlatformId numaralandırma üyesinin temel tamsayı değerini kullanabilirsiniz.