다음을 통해 공유


Environment.OSVersion 속성

현재 플랫폼 식별자와 버전 번호가 들어 있는 OperatingSystem 개체를 가져옵니다.

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

구문

‘선언
Public Shared ReadOnly Property OSVersion As OperatingSystem
‘사용 방법
Dim value As OperatingSystem

value = Environment.OSVersion
public static OperatingSystem OSVersion { get; }
public:
static property OperatingSystem^ OSVersion {
    OperatingSystem^ get ();
}
/** @property */
public static OperatingSystem get_OSVersion ()
public static function get OSVersion () : OperatingSystem

속성 값

OperatingSystem 개체입니다.

예외

예외 형식 조건

InvalidOperationException

이 속성이 시스템 버전을 가져올 수 없는 경우

- 또는 -

가져온 플랫폼 식별자가 PlatformID의 멤버가 아닌 경우

설명

Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE 플랫폼 참고: 이 속성의 버전 수정 필드는 항상 -1입니다.

예제

다음 코드 예제에서는 코드 예제를 실행하는 컴퓨터의 플랫폼 식별자와 버전 번호를 표시합니다.

' 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
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
    Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString());
    }
}
/*
This example produces the following results:

OSVersion: Microsoft Windows NT 5.1.2600.0
*/
// Sample for the Environment::OSVersion property
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "OSVersion: {0}", Environment::OSVersion );
}

/*
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 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에서 지원

참고 항목

참조

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