Created
September 12, 2012 01:04
-
-
Save fresky/3703421 to your computer and use it in GitHub Desktop.
ToDictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<People> peoples = new List<People>(); | |
for (int i = 0; i < 10; i++) | |
{ | |
peoples.Add(new People() { Name = i.ToString() }); | |
} | |
foreach (var source in peoples.ToDictionary(people => people.Name)) | |
{ | |
Console.WriteLine(source.Key); | |
Console.WriteLine(source.Value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment