tags:

views:

38

answers:

2

My seenario,

      how to convert List<KeyValuePair<string, string>> into  IDictionary<string, string>
+6  A: 

Very, very simply with LINQ:

IDictionary<string, string> dictionary =
    list.ToDictionary(pair => pair.Key, pair => pair.Value);

Note that this will fail if there are any duplicate keys - I assume that's okay?

Jon Skeet
+1  A: 

Use ToDictionary() extension method of the Enumerable class.

Andrew Bezzub