Created
April 15, 2014 15:01
-
-
Save amogram/10739617 to your computer and use it in GitHub Desktop.
DIsplay items in dictionary in order.
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
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/a/7105616