BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object System.Runtime.InteropServices.ComVisible(true)

Use the 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.

Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the command line arguments.

  This property provides access to the program name and any arguments specified on the command line when the current process was started.

  The program name can include path information, but is not required to do so. Use the method to retrieve the command-line information parsed and stored in an array of strings.

  The maximum size of the command-line buffer is not set to a specific number of characters; it varies depending on the Windows operating system that is running on the computer.

  Gets the command line for this process.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String A containing the full current working directory path.

  By definition, if this process starts in the root directory of a local or network drive, the value of this property is the drive name followed by a trailing slash (for example, "C:\"). If this process starts in a subdirectory, the value of this property is the drive and subdirectory path, without a trailing slash (for example, "C:\mySubDirectory").

  Gets or sets the fully qualified path of the current working directory.

- Property
  4.0.0.0
  System.Int32 To be added. To be added.

  Gets a unique identifier for the current managed thread.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` The immediate caller does not have the required permission. Requires permission to read environment variables. See . Requires unmanaged code permission. See .

  For the parameter, use a non-zero number to indicate an error. In your application, you can define your own error codes in an enumeration, and return the appropriate error code based on the scenario. For example, return a value of 1 to indicate that the required file is not present and a value of 2 to indicate that the file is in the wrong format. For a list of exit codes used by the Windows operating system, see System Error Codes in the Windows documentation.

  Calling the method differs from using your programming language's return statement in the following ways:

  always terminates an application. Using the return statement may terminate an application only if it is used in the application entry point, such as in the Main method.

  terminates an application immediately, even if other threads are running. If the return statement is called in the application entry point, it causes an application to terminate only after all foreground threads have terminated.

  requires the caller to have permission to call unmanaged code. The return statement does not.

  If is called from a try or finally block, the code in any catch block does not execute. If the return statement is used, the code in the catch block does execute.

  Terminates this process and gives the underlying operating system the specified exit code.

  Exit code to be given to the operating system. Use 0 (zero) to indicate that the process completed successfully. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 0

  A value returned by a process. The default value is zero.

  If the Main method returns void, you can use this property to set the exit code that will be returned to the calling environment. If Main does not return void, this property is ignored. The initial value of this property is zero.

  The property is a signed 32-bit integer. To prevent the property from returning a negative exit code, you should not use values greater than or equal to 0x80000000.

  Use a non-zero number to indicate an error. In your application, you can define your own error codes in an enumeration, and return the appropriate error code based on the scenario. For example, return a value of 1 to indicate that the required file is not present and a value of 2 to indicate that the file is in the wrong format. For a list of exit codes used by the Windows operating system, see System Error Codes in the Windows documentation.

  Gets or sets the exit code of the process.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String ``

  COM interop is used to retrieve the environment variables from the operating system. If the environment variables cannot be retrieved due to a COM error, the HRESULT that explains the cause of the failure is used to generate one of several possible exceptions; that is, the exception depends on the HRESULT. For more information about how the HRESULT is processed, see the Remarks section of the method.

  Replacement only occurs for environment variables that are set. For example, suppose is "MyENV = %MyENV%". If the environment variable, MyENV, is set to 42, this method returns "MyENV = 42". If MyENV is not set, no change occurs; this method returns "MyENV = %MyENV%".

  The size of the return value is limited to 32K on Windows NT 4.0 and earlier, and Windows 2000 and later.

  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.

  A string with each environment variable replaced by its value.

  A string containing the names of zero or more environment variables. Each environment variable is quoted with the percent sign character (%).
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method terminates a process without running any active try/finally blocks or finalizers.

  The method writes the string to the Windows Application event log, creates a dump of your application, and then terminates the current process. The string is also included in error reporting to Microsoft.

  Use the method instead of the method to terminate your application if the state of your application is damaged beyond repair, and executing your application's try/finally blocks and finalizers will corrupt program resources.

  Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft.

  A message that explains why the process was terminated, or null if no explanation is provided.
- Method
  4.0.0.0
  System.Security.SecurityCritical
  System.Void `` ``

  This method terminates the process without running any active try/finally blocks or finalizers.

  The method writes the string to the Windows Application event log, creates a dump of your application, and then terminates the current process.

  Error reporting to Microsoft includes and information, which provides details used to classify the error. Although is not handled because the process is terminated, the contextual information that raised the exception is still obtained.

  If is null, or if is not thrown, this method operates the same as the method overload.

  Use the method instead of the method to terminate your application if the state of your application is damaged beyond repair, and executing your application's try/finally blocks and finalizers will corrupt program resources.

  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.

  A message that explains why the process was terminated, or null if no explanation is provided. An exception that represents the error that caused the termination. This is typically the exception in a catch block.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[]

  The first element in the array contains the file name of the executing program. If the file name is not available, the first element is equal to . The remaining elements contain any additional tokens entered on the command line.

  The program file name can, but is not required to, include path information.

  Command line arguments are delimited by spaces. You can use double quotation marks (") to include spaces within an argument. The single quotation mark ('), however, does not provide this functionality.

  If a double quotation mark follows two or an even number of backslashes, each proceeding backslash pair is replaced with one backslash and the double quotation mark is removed. If a double quotation mark follows an odd number of backslashes, including just one, each preceding pair is replaced with one backslash and the remaining backslash is removed; however, in this case the double quotation mark is not removed.

  The following table shows how command line arguments can be delimited, and assumes MyApp as the current executing application.

  Input at the command line

  Resulting command line arguments

  MyApp alpha beta

  MyApp, alpha, beta

  MyApp "alpha with spaces" "beta with spaces"

  MyApp, alpha with spaces, beta with spaces

  MyApp 'alpha with spaces' beta

  MyApp, 'alpha, with, spaces', beta

  MyApp \\\alpha \\\\"beta

  MyApp, \\\alpha, \\beta

  MyApp \\\\\"alpha \"beta

  MyApp, \\"alpha, "beta

  To obtain the command line as a single string, use the property.

  Returns a string array containing the command-line arguments for the current process.

  An array of string where each element contains a command-line argument. The first element is the executable file name, and the following zero or more elements contain the remaining command-line arguments.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String `` is a null reference. The caller does not have the required permission. Requires permission to read environment variables. See .

  Environment variable names are not case-sensitive.

  To retrieve all environment variables along with their values, call the method.

  Retrieves the value of an environment variable from the current process.

  The value of the environment variable specified by , or null if the environment variable is not found.

  The name of the environment variable. 0
- Method
  2.0.0.0
  4.0.0.0
  System.String `` ``

  The parameter specifies whether the environment variable is retrieved from the current process or from the Windows operating system registry key for the current user or local machine.

  Environment variable names are not case-sensitive.

  To retrieve all environment variables along with their values, call the method.

  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.

  The value of the environment variable specified by the and parameters, or null if the environment variable is not found.

  The name of an environment variable. One of the values.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IDictionary The caller does not have the required permission. Requires permission to read environment variables. See .

  The following example prints the names and values of all environment variables defined in the environment.

  `using System; using System.Collections; class EnvTest:Object { public static void Main() { Console.WriteLine("Environment Variables"); IDictionary envars = Environment.GetEnvironmentVariables(); IDictionaryEnumerator varEnumerator = envars.GetEnumerator(); while(varEnumerator.MoveNext() != false) { Console.WriteLine("{0}={1}", varEnumerator.Key, varEnumerator.Value); } } }`

  The output will vary depending on your system.

  The names and values for the environment variables are stored as key-value pairs in the returned .

  Retrieves all environment variable names and their values from the current process.

  A dictionary that contains all environment variable names and their values; otherwise, an empty dictionary if no environment variables are found.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Collections.IDictionary ``

  The parameter specifies whether the source is the current process, the registry key for the current user, or the registry key for the local machine.

  The names and values of the environment variables are stored as key/value pairs in the returned object.

  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.

  A dictionary that contains all environment variable names and their values from the source specified by the parameter; otherwise, an empty dictionary if no environment variables are found.

  One of the values.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String `` The special folder whose path is to be returned. Returns the path on the file system corresponding to the special folder. The path to the special folder, or the empty string if the special folder is not available or not applicable in the running operating system. See for a list of special folders and their locations on non-Windows operating systems.
- Method
  4.0.0.0
  System.String `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String[] To be added.

  Returns an array of string containing the names of the logical drives on the current computer.

  An array of strings where each element contains the name of a logical drive. For example, if the computer's hard drive is the first logical drive, the first element returned is "C:\".

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  A where indicates the shutdown process has started; otherwise .

  When the CLR unloads an application domain, it runs the finalizers on all objects that have a finalizer method in that application domain. When the CLR shuts down, it starts the finalizer thread on all objects that have a finalizer method. The property returns true only after the finalizer thread has been started. When the property returns true, you can determine whether an application domain is being unloaded or the CLR itself is shutting down by calling the method. This method returns true if finalizers are called because the application domain is unloading or false if the CLR is shutting down.

  The property returns false if the finalizer thread has not been started.

  By using this property, you can determine whether to access static variables in your finalization code. If either an application domain or the CLR is shutting down, you cannot reliably access any object that has a finalization method and that is referenced by a static field. This is because these objects may have already been finalized.

  Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down.

  0
- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Determines whether the current operating system is a 64-bit operating system.

- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Determines whether the current process is a 64-bit process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String The machine name of the computer the application is running on.

  The name of this computer is established at system startup when the name is read from the registry. If this computer is a node in a cluster, the name of the node is returned.

  Gets the NetBIOS name of this local computer.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the characters required to write a newline.

  The following example demonstrates using the property. The string returned by is inserted between "Hello" and "World", causing a line break between the words in the output.

  `using System; class TestClass { public static void Main() { Console.WriteLine("Hello,{0}World", Environment.NewLine); } }`

  The output is

  Hello,

  World

  The property value of is a constant customized specifically for the current platform and implementation of the .NET Framework. For more information about the escape characters in the property value, see Character Escapes.

  The functionality provided by is often what is meant by the terms newline, line feed, line break, carriage return, CRLF, and end of line.

  can be used in conjunction with language-specific newline support such as the escape characters '\r' and '\n' in Microsoft C# and C/C++, or vbCrLf in Microsoft Visual Basic.

  is automatically appended to text processed by the and methods.

  Gets the newline string defined for this environment.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.OperatingSystem A object representing the current platform.

  Typically, the property is used to ensure that an app is running on some base version of an operating system in which a particular feature was introduced. When this is the case, you should perform a version check by testing whether the current operating system version returned by the property is the same as, or greater than, the base operating system version. For more information, see the class topic.

  The property returns the version reported by the Windows GetVersionEx function.

  The property reports the same version number (6.2.0.0) for both win8 and win81.

  In some cases, the property may not return the operating system version that matches the version specified for the Windows Program Compatibility mode feature.

  Gets an object that contains the current platform identifier and version number.

- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added. To be added.

  Gets the number of processors on the current machine.

- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  If the parameter is not empty and the environment variable named by the parameter does not exist, the environment variable is created and assigned the contents of . Solely for purposes of this operation, is considered empty if it is null, contains a zero-length string, or contains an initial hexadecimal zero character (0x00).

  If contains a non-initial hexadecimal zero character, the characters before the zero character are considered the environment variable name and all subsequent characters are ignored.

  If contains a non-initial hexadecimal zero character, the characters before the zero character are assigned to the environment variable and all subsequent characters are ignored.

  If is empty and the environment variable named by exists, the environment variable is deleted. If does not exist, no error occurs even though the operation cannot be performed.

  Creates, modifies, or deletes an environment variable stored in the current process.

  The name of an environment variable. A value to assign to .
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  If the parameter is not empty and the environment variable named by the parameter does not exist, the environment variable is created and assigned the contents of . Solely for the purposes of this operation, is considered empty if it is null, contains a zero-length string, or contains an initial hexadecimal zero character (0x00).

  If contains a non-initial hexadecimal zero character, the characters before the zero character are considered the environment variable name and all subsequent characters are ignored.

  If contains a non-initial hexadecimal zero character, the characters before the zero character are assigned to the environment variable and all subsequent characters are ignored.

  If is empty and the environment variable named by exists, the environment variable is deleted. If does not exist, no error occurs even though the operation cannot be performed. Exercise caution when is because you can delete an environment variable that affects your entire local machine, not just the current process or user.

  If is , the environment variable is stored in the Windows registry key reserved for the current user. It is also copied to instances of File Explorer that are running as the current user. The environment variable is then inherited by any new processes that the user launches from File Explorer.

  Similarly, if is , the environment variable is stored in the Windows registry key reserved for the local computer. It is also copied to all instances of File Explorer. The environment variable is then inherited by any new processes that are launched from File Explorer.

  If is or , other applications are notified of the set operation by a Windows WM_SETTINGCHANGE message.

  If is or , it is recommended that the length of be less than 2048 characters.

  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.

  The name of an environment variable. A value to assign to . One of the values.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing a description of the methods currently in the call stack. This value can be .

  The following example gets the property from within a series of nested calls.

  `using System; public class TestCallStack { public void MyMethod1 () { MyMethod2(); } public void MyMethod2 () { MyMethod3(); } public void MyMethod3 () { Console.WriteLine("TestCallStack: {0}", Environment.StackTrace); } public static void Main() { TestCallStack t = new TestCallStack(); t.MyMethod1(); } }`

  Without debug symbols the output is

  TestCallStack: at System.Environment.GetStackTrace(Exception e)

  at System.Environment.GetStackTrace(Exception e)

  at System.Environment.get_StackTrace()

  at TestCallStack.Main()

  With debug symbols the output is

  TestCallStack: at System.Environment.GetStackTrace(Exception e)

  at System.Environment.GetStackTrace(Exception e)

  at System.Environment.get_StackTrace()

  at TestCallStack.MyMethod3() in c:\ECMAExamples\envstack.cs:line 10

  at TestCallStack.MyMethod2() in c:\ECMAExamples\envstack.cs:line 8

  at TestCallStack.MyMethod1() in c:\ECMAExamples\envstack.cs:line 5

  at TestCallStack.Main() in c:\ECMAExamples\envstack.cs:line 15

  The property lists method calls in reverse chronological order, that is, the most recent method call is described first, and one line of stack trace information is listed for each method call on the stack. However, the property might not report as many method calls as expected due to code transformations that occur during optimization.

  For a hierarchical view of the stack trace information by class, use the class.

  The property formats the stack trace information for each method call as follows:

  "at .() in :line "

  The literal "at" is preceded by three spaces, and the entire substring starting with "in" is omitted if debug symbols are not available. The placeholders, , , , , and , are replaced by actual values, and are defined as follows:

  FullClassName

  The full name of the class, including the namespace.

  The name of the method.

  The list of parameter type/name pairs. Each pair is separated by a comma (","). This information is omitted if takes no parameters.

  The name of the source file where the method is declared. This information is omitted if debug symbols are not available.

  The number of the line in that contains the source code from for the instruction that is on the call stack. This information is omitted if debug symbols are not available.

  The string terminates each line of the stack trace.

  Gets current stack trace information.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String The full path to the 'System' directory.

  An example of the value returned is the string "C:\WinNT\System32".

  Gets the fully qualified path of the system directory.

- Property
  4.0.0.0
  System.Int32 To be added.

  This information can be useful when determining whether to use the option when you work with memory-mapped files.

  In Windows, this value is the dwPageSize member in the SYSTEM_INFO structure.

  Gets the number of bytes in the operating system's memory page.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 496190500

  A value containing the amount of time in milliseconds that has passed since the last time the computer was started.

  The value of this property is derived from the system timer and is stored as a 32-bit signed integer. Consequently, if the system runs continuously, will increment from zero to for approximately 24.9 days, then jump to , which is a negative number, then increment back to zero during the next 24.9 days.

  is different from the property, which is the number of 100-nanosecond intervals that have elapsed since 1/1/0001, 12:00am.

  Use the property to obtain the current local date and time on this computer.

  Gets the number of milliseconds elapsed since the system started.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String Domain name of the current user.

  The domain account credentials for a user are formatted as the user's domain name, the '\' character, and user name. Use the property to obtain the user's domain name without the user name, and the property to obtain the user name without the domain name. For example, if a user's domain name and user name are CORPORATENETWORK\john, the property returns "CORPORATENETWORK".

  The property first attempts to get the domain name component of the Windows account name for the current user. If that attempt fails, this property attempts to get the domain name associated with the user name provided by the property. If that attempt fails because the host computer is not joined to a domain, then the host computer name is returned.

  Gets the network domain name associated with the current user.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The property reports false for a Windows process or a service like IIS that runs without a user interface. If this property is false, do not display modal dialogs or message boxes because there is no graphical user interface for the user to interact with.

  Gets a value indicating whether the current process is running in user interactive mode.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String The username of the account the current process is running under.

  You can use the property to identify the user on the current thread, to the system and application for security or access purposes. It can also be used to customize a particular application for each user.

  The domain account credentials for a user are formatted as the user's domain name, the '\' character, and user name. Use the property to obtain the user's domain name and the property to obtain the user name. A user name is typically an abbreviated combination of the user's first and last names.

  Gets the user name of the person who is currently logged on to the Windows operating system.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Version

  A object that contains the major, minor, build, and revision numbers of the execution engine.

  For more information about the version of the common language runtime that is installed with each version of the .NET Framework, see .NET Framework Versions and Dependencies.

  Gets a object that describes the major, minor, build, and revision numbers of the common language runtime.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64 To be added. To be added.

  Gets the amount of physical memory mapped to the process context.

0