In this article we will learn how to get System Information Using Environment which provides the machine configuration details, program execution environment details as well as some properties which are used to break the one line into a new line which is written in the program for output.
Let us learn the definition of an array so that beginners can also understand.
The environment class is a static class which provides the system configuration, current program execution environment as well as some properties for string manipulation such as news line. System Namespace represents the Environment Class.
The environment class is a combination of functions and Properties which represent the Environment variable details using IDictionary in the form of key,value pairs.
We can also loop through Dictionary to get all the Environment variable details. Before introducing all the Environment variable details, let us go through some frequently used Environment variable details.
As we know, the Environment class is a static class. Because of this, we directly access the methods and properties with the help of the class name itself without creating an object. Let us see
As explained above, the Environment class is a static class which provides some properties and functions as you can see in the above image. You can access the particular property or function as follows.
To demonstrate the above properties, let us create one console application as follows:
Now run the above console application, the output will be as follows:
You can also loop through the Environment class variable as you can.
The output of the above program will be as follows:
I hope this article is useful for all readers. If you have any suggestion regarding this article, then please contact me.