Skip to content

Instantly share code, notes, and snippets.

@amogram
Created April 15, 2014 15:08
Show Gist options
  • Save amogram/10740174 to your computer and use it in GitHub Desktop.
Save amogram/10740174 to your computer and use it in GitHub Desktop.
Using string.Join to flatten dictionary of strings, ordered by value.
string res = "";
var displayOrder = new Dictionary<string, int>(){{"string 2",2},{"string 1",1},{"string 3",3}};
res= string.Join(" - ",displayOrder.OrderBy(x => x.Value).Select(x=>x.Key));
// dump to LINQPad
res.Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment