System.Environment
Use this class to retrieve the following information:
Command-line arguments
Current directory
System directory
Exit codes
Machine name
Domain name
Username
Tick count
Newline character sequence
OS version
Environment variable settings
Contents of the call stack
Version of the CLR
Working set
Listing B.6 shows a sample program calling some of the environment methods and properties (environment.cs).
Listing B.6. Environment Example
static void Main(string [] args) { Console.WriteLine("Command line: {0} ", Environment.CommandLine); Console.WriteLine("Directory: {0} ", Environment.CurrentDirectory); Console.WriteLine("Exit Code: {0} ", Environment.ExitCode); Console.WriteLine("Machine name: {0} ", Environment.MachineName); Console.Write("NewLine: ... |
Get .NET Common Language Runtime Unleashed 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.