RuntimeEnvironment RuntimeEnvironment RuntimeEnvironment RuntimeEnvironment Class

定義

共通言語ランタイム環境に関する情報を返す static メソッドのコレクションを提供します。Provides a collection of static methods that return information about the common language runtime environment.

public ref class RuntimeEnvironment
[System.Runtime.InteropServices.ComVisible(true)]
public class RuntimeEnvironment
type RuntimeEnvironment = class
Public Class RuntimeEnvironment
継承
RuntimeEnvironmentRuntimeEnvironmentRuntimeEnvironmentRuntimeEnvironment
属性

この例で定義されたメソッドの多くを呼び出す方法を示しています、RuntimeEnvironmentクラス。This example shows how to call many of the methods defined by the RuntimeEnvironment class.

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
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.
        Assembly assem = typeof(App).Assembly;
        Console.WriteLine("Did the {0} assembly load from the GAC? {1}",
           assem, RuntimeEnvironment.FromGlobalAccessCache(assem));
        
        // 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
Imports System.Reflection
Imports System.Runtime.InteropServices

Public NotInheritable Class App
    Shared Sub Main()
        ' Show whether the EXE assembly was loaded from the GAC or from a private subdirectory.
        Dim assem As Assembly = GetType(App).Assembly
        Console.WriteLine("Did the {0} assembly load from the GAC? {1}", 
                          assem, RuntimeEnvironment.FromGlobalAccessCache(assem))
        ' 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)
    End Sub
End Class

' 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

コンストラクター

RuntimeEnvironment() RuntimeEnvironment() RuntimeEnvironment() RuntimeEnvironment()

RuntimeEnvironment クラスの新しいインスタンスを初期化します。Initializes a new instance of the RuntimeEnvironment class.

プロパティ

SystemConfigurationFile SystemConfigurationFile SystemConfigurationFile SystemConfigurationFile

システム構成ファイルへのパスを取得します。Gets the path to the system configuration file.

メソッド

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromGlobalAccessCache(Assembly) FromGlobalAccessCache(Assembly) FromGlobalAccessCache(Assembly) FromGlobalAccessCache(Assembly)

指定したアセンブリがグローバル アセンブリ キャッシュに読み込まれているかどうかをテストします。Tests whether the specified assembly is loaded in the global assembly cache.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetRuntimeDirectory() GetRuntimeDirectory() GetRuntimeDirectory() GetRuntimeDirectory()

共通言語ランタイムがインストールされているディレクトリを返します。Returns the directory where the common language runtime is installed.

GetRuntimeInterfaceAsIntPtr(Guid, Guid) GetRuntimeInterfaceAsIntPtr(Guid, Guid) GetRuntimeInterfaceAsIntPtr(Guid, Guid) GetRuntimeInterfaceAsIntPtr(Guid, Guid)

指定されたクラスの指定されたインターフェイスを返します。Returns the specified interface on the specified class.

GetRuntimeInterfaceAsObject(Guid, Guid) GetRuntimeInterfaceAsObject(Guid, Guid) GetRuntimeInterfaceAsObject(Guid, Guid) GetRuntimeInterfaceAsObject(Guid, Guid)

COM オブジェクトを IUnknown インターフェイスへのポインターによって表す型のインスタンスを返します。Returns an instance of a type that represents a COM object by a pointer to its IUnknown interface.

GetSystemVersion() GetSystemVersion() GetSystemVersion() GetSystemVersion()

現在のプロセスを実行している共通言語ランタイムのバージョン番号を取得します。Gets the version number of the common language runtime that is running the current process.

GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象