RuntimeEnvironment Class

Provides a collection of static methods that return information about the common language runtime environment.

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)

public class RuntimeEnvironment
/** @attribute ComVisibleAttribute(true) */ 
public class RuntimeEnvironment
public class RuntimeEnvironment
Not applicable.

This example shows how to call many of the methods defined by the RuntimeEnvironment class.

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}",
        // 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=, 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


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions