This documentation is archived and is not being maintained.
RuntimeEnvironment Class
Visual Studio 2008
Provides a collection of static methods that return information about the common language runtime environment.
Assembly: mscorlib (in mscorlib.dll)
This example shows how to call many of the methods defined by the RuntimeEnvironment class.
Imports System 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. 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) 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
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: