Export (0) Print
Expand All

Environment.OSVersion Property

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

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

'Declaration
Public Shared ReadOnly Property OSVersion As OperatingSystem
'Usage
Dim value As OperatingSystem

value = Environment.OSVersion

/** @property */
public static OperatingSystem get_OSVersion ()

public static function get OSVersion () : OperatingSystem

Not applicable.

Property Value

An OperatingSystem object.

Exception typeCondition

InvalidOperationException

This property was unable to obtain the system version.

-or-

The obtained platform identifier is not a member of PlatformID.

Windows Mobile 2003 for Pocket PC, Windows Mobile 2003 for Smartphone, Windows CE Platform Note: The version revision field for this property is always -1.

The following code example displays the platform identifier and version number of the computer that runs the code example.

' Sample for the Environment.OSVersion property
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString())
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'OSVersion: Microsoft Windows NT 5.1.2600.0
'

// Sample for the Environment.OSVersion property
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        Console.WriteLine();
        Console.WriteLine("OSVersion: {0}", 
            System.Convert.ToString(Environment.get_OSVersion()));
    } //main
} //Sample

/*
This example produces the following results:

OSVersion: Microsoft Windows NT 5.1.2600.0
*/

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft