Reactions to story from Blogs - ASP.NET Weblogs
Linq: The Missing ToDictionary Extension Method Overload
http://weblogs.asp.net/ okloeten/ archive/ 2008/ 04/ 22/ 6121417.aspx
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? public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> enumeration) { // Check to see that enumeration is not null if (enumeration == null) throw new ArgumentNullException("enumeration"); return enumeration.ToDictionary(item => item.Key, item => item.Value); } Well, that little bit of code settles that.
More rising blog posts
-
Entertainment »
America's Next Top Model: How Whitney Beat Anya -
Business »
grade inflation [Dynamics of Cats] -
Lifestyle »
The Most Civilized Country. -
Politics »
Reverse Evolution in Sticklebacks? [Afarensis] -
Sports »
IIHF names 'Miracle on Ice' top hockey story of century -
Technology »
My Critter's Better Than Your Critter
More rising news stories
-
Entertainment »
If a Lender Be, What Are the Rules? -
Business »
Old gas pumps can't handle ever-rising prices - USATODAY.com -
Lifestyle »
Man opens fire at church festival -
Politics »
Immigration Raid Jars a Small Town -
Sports »
Major League Soccer Roundup, May 17 -
Technology »
Routine Web conduct at risk due to MySpace suicide case
Recent posts from Blogs - ASP.NET Weblogs
-
Solving LINQ's N-Tier Issues
10 days ago -
Wanna win an XBox!
10 days ago -
Le livre Professional ASP.NET 3.5 (seulement $16 sur Amazon.com pour une courte durée)
10 days ago