Created
October 26, 2012 07:35
-
-
Save smiler/3957435 to your computer and use it in GitHub Desktop.
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
var loltable = new[] { | |
new { Property = "Name", Value = "Glenn", Id = 7 }, | |
new { Property = "LastName", Value = "Brax", Id = 7 }, | |
new { Property = "Active", Value = "1", Id = 7 }, | |
new { Property = "Name", Value = "Kossa", Id = 5 }, | |
new { Property = "LastName", Value = "Mu", Id = 5 }, | |
new { Property = "Active", Value = "0", Id = 5 }, | |
new { Property = "Name", Value = "Trololol", Id = 2 }, | |
new { Property = "LastName", Value = "Håhåhå", Id = 2 }, | |
new { Property = "Active", Value = "1", Id = 2 } | |
}; | |
var lol = from lol in loltable | |
group lol by lol.Id into lolGroups | |
select new { | |
Id = lolGroups.Key, | |
Name = lolGroups.First (g => g.Property == "Name").Value, | |
LastName = lolGroups.First (g => g.Property == "LastName").Value, | |
Active = lolGroups.First (g => g.Property == "Active").Value | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment