5.5. Access to the environment

The System.Environment class provides information about the current environment and platform. It contains the following properties and methods, which can be used in our applications:

  • CommandLine This property returns the String that contains the command line supplied for this process.

  • CurrentDirectory Indicates the directory (String type) from which this process was started.

  • ExitCode Specifies the exit code for this process as an Integer value.

  • MachineName Contains the String with the name of the computer you are using.

  • NewLine Contains the new line String for this environment.

  • OSVersion Contains an OperatingSystem object.

  • StackTrace This property returns the current stack trace information as a String.

  • SystemDirectory ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.