Environment.OSVersion Property


Gets an OperatingSystem object that contains the current platform identifier and version number.

 static property OperatingSystem ^ OSVersion { OperatingSystem ^ get(); };
public static OperatingSystem OSVersion { get; }
member this.OSVersion : OperatingSystem
Public Shared ReadOnly Property OSVersion As OperatingSystem

Property Value


An object that contains the platform identifier and version number.


This property was unable to obtain the system version.


The obtained platform identifier is not a member of PlatformID


The Environment.OSVersion property does not provide a reliable way to identify the exact operating system and its version. Therefore, we do not recommend that you use this method. Instead:

  • To identify the operating system platform, use the RuntimeInformation.IsOSPlatform method.

  • Avoid writing code that depends on a reported operating system version. Instead, check for the availability of the features that your application needs.

Applies to