OperatingSystem Sınıf
Tanım
Sürüm ve platform tanımlayıcısı gibi bir işletim sistemi hakkındaki bilgileri temsil eder.Represents information about an operating system, such as the version and platform identifier. Bu sınıf devralınamaz.This class cannot be inherited.
public ref class OperatingSystem sealed : ICloneable, System::Runtime::Serialization::ISerializable
public ref class OperatingSystem sealed : ICloneable
public sealed class OperatingSystem : ICloneable, System.Runtime.Serialization.ISerializable
[System.Serializable]
public sealed class OperatingSystem : ICloneable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class OperatingSystem : ICloneable, System.Runtime.Serialization.ISerializable
type OperatingSystem = class
interface ICloneable
interface ISerializable
[<System.Serializable>]
type OperatingSystem = class
interface ICloneable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type OperatingSystem = class
interface ICloneable
interface ISerializable
Public NotInheritable Class OperatingSystem
Implements ICloneable, ISerializable
Public NotInheritable Class OperatingSystem
Implements ICloneable
- Devralma
-
OperatingSystem
- Öznitelikler
- Uygulamalar
Örnekler
Aşağıdaki kod örneği, OperatingSystem çalışma zamanı işletim sistemiyle ilgili bilgileri göstermek için nesnesini kullanır.The following code example uses the OperatingSystem object to display information about the runtime operating system.
using System;
public class Example
{
public static void Main()
{
var os = Environment.OSVersion;
Console.WriteLine("Current OS Information:\n");
Console.WriteLine("Platform: {0:G}", os.Platform);
Console.WriteLine("Version String: {0}", os.VersionString);
Console.WriteLine("Version Information:");
Console.WriteLine(" Major: {0}", os.Version.Major);
Console.WriteLine(" Minor: {0}", os.Version.Minor);
Console.WriteLine("Service Pack: '{0}'", os.ServicePack);
}
}
// If run on a Windows 8.1 system, the example displays output like the following:
// Current OS Information:
//
// Platform: Win32NT
// Version String: Microsoft Windows NT 6.2.9200.0
// Version Information:
// Major: 6
// Minor: 2
// Service Pack: ''
// If run on a Windows 7 system, the example displays output like the following:
// Current OS Information:
//
// Platform: Win32NT
// Version String: Microsoft Windows NT 6.1.7601 Service Pack 1
// Version Information:
// Major: 6
// Minor: 1
// Service Pack: 'Service Pack 1'
Module Example
Public Sub Main()
Dim os As OperatingSystem = Environment.OSVersion
Console.WriteLine("Current OS Information:")
Console.WriteLine()
Console.WriteLine("Platform: {0:G}", os.Platform)
Console.WriteLine("Version String: {0}", os.VersionString)
Console.WriteLine("Version Information:")
Console.WriteLine(" Major: {0}", os.Version.Major)
Console.WriteLine(" Minor: {0}", os.Version.Minor)
Console.WriteLine("Service Pack: '{0}'", os.ServicePack)
End Sub
End Module
' If run on a Windows 8.1 system, the example displays output like the following:
' Current OS Information:
'
' Platform: Win32NT
' Version String: Microsoft Windows NT 6.2.9200.0
' Version Information:
' Major: 6
' Minor: 2
' Service Pack: ''
' If run on a Windows 7 system, the example displays output like the following:
' Current OS Information:
'
' Platform: Win32NT
' Version String: Microsoft Windows NT 6.1.7601 Service Pack 1
' Version Information:
' Major: 6
' Minor: 1
' Service Pack: 'Service Pack 1'
Açıklamalar
OperatingSystemSınıfı, bir işletim sistemi hakkında bilgi içerir.The OperatingSystem class contains information about an operating system.
Geçerli çalışma zamanı işletim sistemi hakkında daha fazla bilgi için, OperatingSystem özelliği tarafından döndürülen nesneyi alın Environment.OSVersion .For information about the current runtime operating system, retrieve the OperatingSystem object returned by the Environment.OSVersion property. Windows işletim sistemi sürümlerinin ve ve özelliklerine ve yöntemine göre döndürülen sürüm numaralarıyla ilgili bir liste Version için VersionString ToString , bkz. işletim sistemi sürümü.For a list of Windows operating system versions and their corresponding version numbers returned by the Version and VersionString properties and the ToString method, see Operating System Version.
Tasarım, sınıf, OperatingSystem bir işletim sistemini tanımlamak için genel bir amaç değildir ve sınıfından daha kapsamlı bir tür türetilemez OperatingSystem .By design, the OperatingSystem class is not a general purpose means of describing an operating system, and you cannot derive a more inclusive type from the OperatingSystem class. Bir işletim sistemiyle ilgili diğer bilgileri içermesi için bir türe ihtiyacınız varsa, kendi türünü oluşturun, ardından türünde bir alan OperatingSystem ve ihtiyacınız olan ek alanlar, özellikler veya yöntemler ekleyin.If you need a type to contain other information about an operating system, create your own type, then include a field of type OperatingSystem and any additional fields, properties, or methods that you require.
Oluşturucular
| OperatingSystem(PlatformID, Version) |
OperatingSystemBelirtilen platform tanımlayıcı değer ve sürüm nesnesini kullanarak sınıfının yeni bir örneğini başlatır.Initializes a new instance of the OperatingSystem class, using the specified platform identifier value and version object. |
Özellikler
| Platform |
PlatformIDİşletim sistemi platformunu tanımlayan bir sabit listesi değeri alır.Gets a PlatformID enumeration value that identifies the operating system platform. |
| ServicePack |
Bu nesne tarafından temsil edilen hizmet paketi sürümünü alır OperatingSystem .Gets the service pack version represented by this OperatingSystem object. |
| Version |
Versionİşletim sistemini tanımlayan bir nesne alır.Gets a Version object that identifies the operating system. |
| VersionString |
İşletim sisteminde yüklü olan platform tanımlayıcısı, sürümü ve hizmet paketinin birleştirilmiş dize temsilini alır.Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system. |
Yöntemler
| Clone() |
OperatingSystemBu örnekle özdeş bir nesne oluşturur.Creates an OperatingSystem object that is identical to this instance. |
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified object is equal to the current object. (Devralındığı yer: Object) |
| GetHashCode() |
Varsayılan karma işlevi olarak işlev görür.Serves as the default hash function. (Devralındığı yer: Object) |
| GetObjectData(SerializationInfo, StreamingContext) |
SerializationInfoBu örneğin serisini kaldırmak için bir nesneyi gereken verilerle doldurur.Populates a SerializationInfo object with the data necessary to deserialize this instance. |
| GetType() |
TypeGeçerli örneği alır.Gets the Type of the current instance. (Devralındığı yer: Object) |
| IsAndroid() |
Geçerli uygulamanın Android üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on Android. |
| IsAndroidVersionAtLeast(Int32, Int32, Int32, Int32) |
Android sürümünün (Linux komutu tarafından döndürülen) olup olmadığını denetlerChecks if the Android version (returned by the Linux command |
| IsBrowser() |
Geçerli uygulamanın bir tarayıcıda mi olarak çalışıp çalışmadığını belirtir.Indicates whether the current application is running as WASM in a browser. |
| IsFreeBSD() |
Geçerli uygulamanın FreeBSD üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on FreeBSD. |
| IsFreeBSDVersionAtLeast(Int32, Int32, Int32, Int32) |
FreeBSD sürümünün (Linux komutu tarafından döndürülen) olup olmadığını denetlerChecks if the FreeBSD version (returned by the Linux command |
| IsIOS() |
Geçerli uygulamanın iOS üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on iOS. |
| IsIOSVersionAtLeast(Int32, Int32, Int32) |
İOS sürümünün (tarafından döndürülen) olup olmadığını denetlerChecks if the iOS version (returned by |
| IsLinux() |
Geçerli uygulamanın Linux üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on Linux. |
| IsMacOS() |
Geçerli uygulamanın macOS üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on macOS. |
| IsMacOSVersionAtLeast(Int32, Int32, Int32) |
MacOS sürümünün (tarafından döndürülen) olup olmadığını denetlerChecks if the macOS version (returned by |
| IsOSPlatform(String) |
Belirtilen platformda geçerli uygulamanın çalışıp çalışmadığını belirtir.Indicates whether the current application is running on the specified platform. |
| IsOSPlatformVersionAtLeast(String, Int32, Int32, Int32, Int32) |
İşletim sistemi sürümünün belirtilen platform sürümüne eşit veya ondan büyük olup olmadığını denetler.Checks if the operating system version is greater than or equal to the specified platform version. Bu yöntem, belirtilen işletim sistemi sürümüne eklenen API 'Leri korumak için kullanılabilir.This method can be used to guard APIs that were added in the specified OS version. |
| IsTvOS() |
Geçerli uygulamanın tvOS üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on tvOS. |
| IsTvOSVersionAtLeast(Int32, Int32, Int32) |
TvOS sürümünün (tarafından döndürülen) olup olmadığını denetlerChecks if the tvOS version (returned by |
| IsWatchOS() |
Geçerli uygulamanın watchOS üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on watchOS. |
| IsWatchOSVersionAtLeast(Int32, Int32, Int32) |
WatchOS sürümünün (tarafından döndürülen) olup olmadığını denetlerChecks if the watchOS version (returned by |
| IsWindows() |
Geçerli uygulamanın Windows üzerinde çalışıp çalışmadığını belirtir.Indicates whether the current application is running on Windows. |
| IsWindowsVersionAtLeast(Int32, Int32, Int32, Int32) |
Windows sürümünün (tarafından döndürülen) olup olmadığını denetlerChecks if the Windows version (returned by |
| MemberwiseClone() |
Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object. (Devralındığı yer: Object) |
| ToString() |
Bu OperatingSystem nesnenin değerini eşdeğer dize gösterimine dönüştürür.Converts the value of this OperatingSystem object to its equivalent string representation. |