다음을 통해 공유


OperatingSystem.Version 속성

운영 체제를 식별하는 System.Version 개체를 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public ReadOnly Property Version As Version
‘사용 방법
Dim instance As OperatingSystem
Dim value As Version

value = instance.Version
public Version Version { get; }
public:
property Version^ Version {
    Version^ get ();
}
/** @property */
public Version get_Version ()
public function get Version () : Version

속성 값

운영 체제의 주 버전, 부 버전, 빌드 버전 및 수정 버전을 나타내는 Version 개체입니다.

예제

다음 코드 예제에서는 몇 개의 OperatingSystem 개체를 만들고 각 개체에 대한 Version 속성을 표시합니다.

' Example for the OperatingSystem.Platform and 
' OperatingSystem.Version properties.
Imports System
Imports Microsoft.VisualBasic

Module PlatformVersionDemo
    
    ' Create an OperatingSystem object, and display the Platform
    ' and Version properties.
    Sub BuildOSObj( pID As PlatformID, ver As Version )

        Dim opSys       As New OperatingSystem( pID, ver )
        Dim platform    As PlatformID = opSys.Platform
        Dim version     As Version = opSys.Version

        Console.WriteLine( "   Platform: {0,-15} Version: {1}", _
            platform, version )
    End Sub 
        
    Sub BuildOperatingSystemObjects( )

        ' The Version object does not need to correspond to an 
        ' actual OS version.
        Dim verNull     As New Version( )
        Dim verString   As New Version( "3.5.8.13" )
        Dim verMajMin   As New Version( 6, 10 )
        Dim verMMBld    As New Version( 5, 25, 5025 )
        Dim verMMBVer   As New 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 )
    End Sub 
        
    Sub Main( )
        Console.WriteLine( _
            "This example of OperatingSystem.Platform " & _
            "and OperatingSystem.Version " & vbCrLf & _
            "generates the following output." & vbCrLf )
        Console.WriteLine( _
            "Create several OperatingSystem objects " & _
            "and display their properties:" & vbCrLf )

        BuildOperatingSystemObjects( )
            
        Console.WriteLine(vbCrLf & _
            "The operating system of the host computer is: " & _
            vbCrLf )

        BuildOSObj( _
            Environment.OSVersion.Platform, _
            Environment.OSVersion.Version )
    End Sub 
End Module 

' 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: 3.5.8.13
'    Platform: Win32Windows    Version: 6.10
'    Platform: WinCE           Version: 5.25.5025
'    Platform: Win32NT         Version: 5.6.7.8
' 
' The operating system of the host computer is:
' 
'    Platform: Win32NT         Version: 5.1.2600.0
// Example for the OperatingSystem.Platform and 
// OperatingSystem.Version properties.
using System;

class PlatformVersionDemo
{
    // Create an OperatingSystem object and display the Platform
    // and Version properties.
    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 BuildOperatingSystemObjects( )
    { 
        // The Version object does not need to correspond to an 
        // actual OS version.
        Version verNull     = new Version( );
        Version verString   = new Version( "3.5.8.13" );
        Version verMajMin   = new Version( 6, 10 );
        Version verMMBld    = new Version( 5, 25, 5025 );
        Version verMMBVer   = new 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 );
    } 
        
    static void 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" );

        BuildOperatingSystemObjects( );
            
        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: 3.5.8.13
Platform: Win32Windows    Version: 6.10
Platform: WinCE           Version: 5.25.5025
Platform: Win32NT         Version: 5.6.7.8

The operating system of the host computer is:

Platform: Win32NT         Version: 5.1.2600.0
*/
// 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( "3.5.8.13" );
   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" );
   BuildOperatingSystemObjects();
   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: 3.5.8.13
   Platform: Win32Windows    Version: 6.10
   Platform: WinCE           Version: 5.25.5025
   Platform: Win32NT         Version: 5.6.7.8

The operating system of the host computer is:

   Platform: Win32NT         Version: 5.1.2600.0
*/
// Example for the OperatingSystem.Platform and 
// OperatingSystem.Version properties.
import System.*;

class PlatformVersionDemo
{
    // Create an OperatingSystem object and display the Platform
    // and Version properties.
    static void BuildOSObj(PlatformID pID, Version ver)
    {
        OperatingSystem opSys = new OperatingSystem(pID, ver);
        PlatformID platform = opSys.get_Platform();
        Version version = opSys.get_Version();
        Console.WriteLine("   Platform: {0,-15} Version: {1}",
            platform, version);
    } //BuildOSObj

    static void BuildOperatingSystemObjects()
    {
        // The Version object does not need to correspond to an 
        // actual OS version.
        Version verNull = new Version();
        Version verString = new Version("3.5.8.13");
        Version verMajMin = new Version(6, 10);
        Version verMMBld = new Version(5, 25, 5025);
        Version verMMBVer = new 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);
    } //BuildOperatingSystemObjects

    public static void main(String[] args)
    {
        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"));
        BuildOperatingSystemObjects();
        Console.WriteLine("\nThe operating system of the host computer is:\n");
        BuildOSObj(Environment.get_OSVersion().get_Platform(),
            Environment.get_OSVersion().get_Version());
    } //main
} //PlatformVersionDemo

/*
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: 3.5.8.13
Platform: Win32Windows    Version: 6.10
Platform: WinCE           Version: 5.25.5025
Platform: Win32NT         Version: 5.6.7.8

The operating system of the host computer is:

Platform: Win32NT         Version: 5.1.2600.0
*/

플랫폼

Windows 98, Windows 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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

OperatingSystem 클래스
OperatingSystem 멤버
System 네임스페이스