Skip to content

Instantly share code, notes, and snippets.

@amogram
Created April 15, 2014 15:01
Show Gist options
  • Save amogram/10739617 to your computer and use it in GitHub Desktop.
Save amogram/10739617 to your computer and use it in GitHub Desktop.
DIsplay items in dictionary in order.
string res = "";
var displayOrder = new Dictionary<string, int>(){{"string two",2},{"string 1",1},{"string 3",3}};
res = "Person ID" + displayOrder.OrderBy(x => x.Value).Aggregate(res, (current, x) => current + " - " + x.Key);
// for demo in LINQPad
res.Dump();
@amogram
Copy link
Author

amogram commented Apr 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment