Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created November 25, 2010 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpowell/714975 to your computer and use it in GitHub Desktop.
Save aaronpowell/714975 to your computer and use it in GitHub Desktop.
var dict = new Dictionary<string, int> {
{ "John", 3 },
{ "Mary", 4 }
};
var flattened = dict.Select(x =>
Enumerable.Range(0, x.Value).Select(_ => x.Key)
)
.SelectMany(x => x);
Console.Write(flattened);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment