What is the use of System.Environment class in C#.NET?

What is the use of System.Environment class in C#.NET?

- The System.Environment class can be used to retrieve information like:

a. Command-line arguments.
b. The exit code.
c. Environment variable settings.
d. Contents of the call stack.
e. Time since last system boot.
f. The version of the common language runtime.

- It provides the information about the current environment and platform.

- This class is mostly used to retrieve environment variable settings, version of the common language runtime etc.

- System.Environment class cannot be inherited.

- Using System.Environment.OS.Version.ToString(), it will return your current operating system.

- Using System.Environment.MachineName, it will return your current machine name.

- Using System.Environment.CurrentDirectory, it will return your current working directory.

- Using System.Environment.UserName, it will return your current user name.
Difference between const and readonly in C#.NET
What is the difference between const and readonly in C#.NET? - The read only can be modified by the class it is contained in...
Advantages of CLR procedure over T-SQL procedure - C#.NET
Advantages of CLR procedure over T-SQL procedure - The use of the CLR procedure makes it possible to do the complex database operations...
How does C# Generics and C++ Templates compare? - C#.NET
How does C# Generics and C++ Templates compare? - C# generics and templates in C++ are more or less similar syntactically...
Post your comment