using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main(string[] args) {
Dictionary<string, int> dic = new Dictionary<string, int>();
dic.Add("c#", 99);
dic.Add("php", 44);
dic.Add("c++", 888);
dic.Add("java", 1);
var sortedDic = from entry in dic orderby entry.Value ascending select entry;
foreach (KeyValuePair<string, int> keyval in sortedDic) {
Console.WriteLine("Key = {0}, Value = {1}", keyval.Key, keyval.Value);
}
}
}
/*
run:
Key = java, Value = 1
Key = php, Value = 44
Key = c#, Value = 99
Key = c++, Value = 888
*/