Get all environment variable names and their values from the current process in CSharp
Description
The following code shows how to get all environment variable names and their values from the current process.
Example
// ww w . ja va 2s. com
using System;
using System.Collections;
class Sample
{
public static void Main()
{
IDictionary environmentVariables = Environment.GetEnvironmentVariables();
foreach (DictionaryEntry de in environmentVariables)
{
Console.WriteLine(" {0} = {1}", de.Key, de.Value);
}
}
}
The code above generates the following result.