C# OperatingSystem Platform

Description

OperatingSystem Platform gets a System.PlatformID enumeration value that identifies the operating system platform.

Syntax

OperatingSystem.Platform has the following syntax.


public PlatformID Platform { get; }

Example

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


using System;//  w w  w. ja v a 2  s.  c  o  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