RuntimeEnvironment 클래스
공용 언어 런타임 환경에 대한 정보를 반환하는 static 메서드 컬렉션을 제공합니다.
네임스페이스: System.Runtime.InteropServices
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
<ComVisibleAttribute(True)> _
Public Class RuntimeEnvironment
‘사용 방법
Dim instance As RuntimeEnvironment
[ComVisibleAttribute(true)]
public class RuntimeEnvironment
[ComVisibleAttribute(true)]
public ref class RuntimeEnvironment
/** @attribute ComVisibleAttribute(true) */
public class RuntimeEnvironment
ComVisibleAttribute(true)
public class RuntimeEnvironment
예제
이 예제에서는 RuntimeEnvironment 클래스에서 정의한 많은 메서드를 호출하는 방법을 보여 줍니다.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
public sealed class App
{
static void Main()
{
// Show whether the EXE assembly was loaded from the GAC or from a private subdirectory.
Console.WriteLine("Did the {0} assembly load from the GAC? {1}",
Assembly.GetExecutingAssembly(),
RuntimeEnvironment.FromGlobalAccessCache(Assembly.GetExecutingAssembly()));
// Show the path where the CLR was loaded from.
Console.WriteLine("Runtime directory: {0}", RuntimeEnvironment.GetRuntimeDirectory());
// Show the CLR's version number.
Console.WriteLine("System version: {0}", RuntimeEnvironment.GetSystemVersion());
// Show the path of the machine's configuration file.
Console.WriteLine("System configuration file: {0}", RuntimeEnvironment.SystemConfigurationFile);
}
}
// This code produces the following output.
//
// Did the RuntimeEnvironment, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// assembly load from the GAC? False
// Runtime directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\
// System version: v2.0.40607
// System configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\config\
// machine.config
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
int main()
{
// Show whether the EXE assembly was loaded from the GAC or from a
// private subdirectory.
Console::WriteLine("Did the {0} assembly load from the GAC? {1}",
Assembly::GetExecutingAssembly(),
RuntimeEnvironment::FromGlobalAccessCache(
Assembly::GetExecutingAssembly()));
// Show the path where the CLR was loaded from.
Console::WriteLine("Runtime directory: {0}",
RuntimeEnvironment::GetRuntimeDirectory());
// Show the CLR's version number.
Console::WriteLine("System version: {0}",
RuntimeEnvironment::GetSystemVersion());
// Show the path of the machine's configuration file.
Console::WriteLine("System configuration file: {0}",
RuntimeEnvironment::SystemConfigurationFile);
}
// This code produces the following output.
//
// Did the RuntimeEnvironment, Version=0.0.0.0, Culture=neutral,
// PublicKeyToken=null
// assembly load from the GAC? False
// Runtime directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\
// System version: v2.0.40607
// System configuration file:
// C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\config\machine.config
상속 계층 구조
System.Object
System.Runtime.InteropServices.RuntimeEnvironment
스레드로부터의 안전성
이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, 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에서 지원