OperatingSystem::Version Property

Gets a System::Version object that identifies the operating system.

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

property Version^ Version {
	Version^ get ();

Property Value

Type: System::Version
A Version object that describes the major version, minor version, build, and revision numbers for the operating system.

See Operating System Version on the Windows Dev Center for a list of Windows operating system versions and their corresponding version numbers.

The following code example creates several OperatingSystem objects and displays the Version property for each.

// Example for the OperatingSystem.Platform and  
// OperatingSystem.Version properties. 
using namespace System;

// Create an OperatingSystem object and display the Platform 
// and Version properties. 
void BuildOSObj( PlatformID pID, Version^ ver )
   OperatingSystem^ opSys = gcnew OperatingSystem( pID,ver );
   PlatformID platform = opSys->Platform;
   Version^ version = opSys->Version;
   Console::WriteLine( "   Platform: {0,-15} Version: {1}", platform, version );

void BuildOperatingSystemObjects()

   // The Version object does not need to correspond to an  
   // actual OS version.
   Version^ verNull = gcnew Version;
   Version^ verString = gcnew Version( "" );
   Version^ verMajMin = gcnew Version( 6,10 );
   Version^ verMMBld = gcnew Version( 5,25,5025 );
   Version^ verMMBVer = gcnew Version( 5,6,7,8 );

   // All PlatformID members are shown here.
   BuildOSObj( PlatformID::Win32NT, verNull );
   BuildOSObj( PlatformID::Win32S, verString );
   BuildOSObj( PlatformID::Win32Windows, verMajMin );
   BuildOSObj( PlatformID::WinCE, verMMBld );
   BuildOSObj( PlatformID::Win32NT, verMMBVer );

int main()
   Console::WriteLine( "This example of OperatingSystem::Platform " 
   "and OperatingSystem::Version \n" 
   "generates the following output.\n" );
   Console::WriteLine( "Create several OperatingSystem objects " 
   "and display their properties:\n" );
   Console::WriteLine( "\nThe operating system of the host computer is:\n" );
   BuildOSObj( Environment::OSVersion->Platform, Environment::OSVersion->Version );

This example of OperatingSystem::Platform and OperatingSystem::Version
generates the following output.

Create several OperatingSystem objects and display their properties:

   Platform: Win32NT         Version: 0.0
   Platform: Win32S          Version:
   Platform: Win32Windows    Version: 6.10
   Platform: WinCE           Version: 5.25.5025
   Platform: Win32NT         Version:

The operating system of the host computer is:

   Platform: Win32NT         Version: 5.1.2600.0

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft