Skip to content

Instantly share code, notes, and snippets.

@JamieDixon
Created July 8, 2014 14:02
Show Gist options
  • Save JamieDixon/a90a7162a6fe8f63354d to your computer and use it in GitHub Desktop.
Save JamieDixon/a90a7162a6fe8f63354d to your computer and use it in GitHub Desktop.
model.Countries =
(profile.Countries.GroupBy(
x => x.ContinentName,
y => y,
(key, g) =>
new
{
Key = key,
Value =
g.Select(
s => new SelectListItem { Text = s.CountryName, Value = s.CountryRegionCode, })
}))
.ToDictionary(x => x.Key, x => x.Value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment