Environment Class
Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | CommandLine | Gets the command line for this process. |
![]() ![]() | CurrentDirectory | Gets or sets the fully qualified path of the current working directory. |
![]() ![]() | CurrentManagedThreadId | Gets a unique identifier for the current managed thread. |
![]() ![]() | ExitCode | Gets or sets the exit code of the process. |
![]() ![]() | HasShutdownStarted | Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down. |
![]() ![]() | Is64BitOperatingSystem | Determines whether the current operating system is a 64-bit operating system. |
![]() ![]() | Is64BitProcess | Determines whether the current process is a 64-bit process. |
![]() ![]() | MachineName | Gets the NetBIOS name of this local computer. |
![]() ![]() | NewLine | Gets the newline string defined for this environment. |
![]() ![]() | OSVersion | Gets an OperatingSystem object that contains the current platform identifier and version number. |
![]() ![]() | ProcessorCount | Gets the number of processors on the current machine. |
![]() ![]() | StackTrace | Gets current stack trace information. |
![]() ![]() | SystemDirectory | Gets the fully qualified path of the system directory. |
![]() ![]() | SystemPageSize | Gets the number of bytes in the operating system's memory page. |
![]() ![]() | TickCount | Gets the number of milliseconds elapsed since the system started. |
![]() ![]() | UserDomainName | Gets the network domain name associated with the current user. |
![]() ![]() | UserInteractive | Gets a value indicating whether the current process is running in user interactive mode. |
![]() ![]() | UserName | Gets the user name of the person who is currently logged on to the Windows operating system. |
![]() ![]() | Version | Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime. |
![]() ![]() | WorkingSet | Gets the amount of physical memory mapped to the process context. |
| Name | Description | |
|---|---|---|
![]() ![]() | Exit(Int32) | Terminates this process and returns an exit code to the operating system. |
![]() ![]() | ExpandEnvironmentVariables(String) | Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string. |
![]() ![]() | FailFast(String) | Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft. |
![]() ![]() | FailFast(String, Exception) | Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft. |
![]() ![]() | GetCommandLineArgs() | Returns a string array containing the command-line arguments for the current process. |
![]() ![]() | GetEnvironmentVariable(String) | Retrieves the value of an environment variable from the current process. |
![]() ![]() | GetEnvironmentVariable(String, EnvironmentVariableTarget) | Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine. |
![]() ![]() | GetEnvironmentVariables() | Retrieves all environment variable names and their values from the current process. |
![]() ![]() | GetEnvironmentVariables(EnvironmentVariableTarget) | Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine. |
![]() ![]() | GetFolderPath(Environment.SpecialFolder) | Gets the path to the system special folder that is identified by the specified enumeration. |
![]() ![]() | GetFolderPath(Environment.SpecialFolder, Environment.SpecialFolderOption) | Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders. |
![]() ![]() | GetLogicalDrives() | Returns an array of string containing the names of the logical drives on the current computer. |
![]() ![]() | SetEnvironmentVariable(String, String) | Creates, modifies, or deletes an environment variable stored in the current process. |
![]() ![]() | SetEnvironmentVariable(String, String, EnvironmentVariableTarget) | Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine. |
Use the Environment class to retrieve information such as command-line arguments, the exit code, environment variable settings, contents of the call stack, time since last system boot, and the version of the common language runtime.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


