Output a list/other data structure using linq query

Viewed 25081

is there a way to do a Console.WriteLine() on a Generic Collection example: List a has:

a.Key[0]: apple
a.Value[0]: 1

a.Key[1]: bold
a.Value[2]: 2

Is there a way to write out the List contents: Key, Value using LINQ?

a = a.OrderByDescending(x => x.Value));

foreach (KeyValuePair pair in car) 
{ 
    Console.WriteLine(pair.Key + ' : ' + pair.Value); 
} 

Instead of the foreach I want to write a Linq / query... is it possible?

3 Answers
Related