Linq: The Missing ToDictionary Extension Method Overload

2008-04-22
1 min read

Enumerating over a Dictionary<TKey, TValue> you will get structs of type KeyValuePair<TKey, TValue>. Whenever you use the ToDictionary extension method, you are forced to specify how to get the key and value for each item, even if it’s an enumeration of KeyValuePairs. Seems a bit redundant, doesn’t it?…

You can read the copy of the original post, or if that goes down too, you can try the Wayback Machine’s copy of it.

Context: This post was automatically imported from my old blog, which was originally hosted on Microsoft’s ASP.NET Community Blogs. When they shut it down, I dumped all of my old posts to Wordpress. You can still check out the original blog on the Wayback Machine.