C# OperatingSystem Version

Description

OperatingSystem Version gets a System.Version object that identifies the operating system.

Syntax

OperatingSystem.Version has the following syntax.


public Version Version { get; }

Example

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


using System;// w  w w  . j a  v a 2 s .  co  m

class PlatformVersionDemo
{
    static void BuildOSObj( PlatformID pID, Version ver )
    {
        OperatingSystem opSys   = new OperatingSystem( pID, ver );
        PlatformID platform     = opSys.Platform;
        Version version         = opSys.Version;

        Console.WriteLine( "   Platform: {0,-15} Version: {1}", platform, version );
    } 

    static void Main( )
    {
        Version verNull     = new Version( );
        Version verString   = new Version( "1.5.8.13" );

        BuildOSObj( PlatformID.Win32NT, verNull );
        BuildOSObj( PlatformID.Win32S, verString );
    } 
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version