IDictionary.GetEnumerator()
returns an IDictionaryEnumerator
, which has a property Entry
that returns the current element (both key and value) of type DictionaryEntry
, so that's the type you are using:
static void Main()
{
var envVars = Environment.GetEnvironmentVariables();
Parallel.ForEach( envVars.Cast<DictionaryEntry>(), ev =>
{
Console.WriteLine( "{0}: {1}", ev.Key, ev.Value );
} );
Console.ReadLine();
}