Skip to content

Instantly share code, notes, and snippets.

@guyellis
Created October 10, 2013 17:29
Show Gist options
  • Save guyellis/6922284 to your computer and use it in GitHub Desktop.
Save guyellis/6922284 to your computer and use it in GitHub Desktop.
How to convert an IEnumerable to a dictionary using LINQ
// If you want to convert an IEnumerable to a dictionary using LINQ then do:
Dictionary<string, object> dict = myList.ToDictionary(a => a.MyString, a => a.MyObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment