C#3.0 Lambda表达式 (VS2008)的实现方法:
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("Arraymin", "c:\\demo\\min.xsl");
dic.Add("Arraymax", "c:\\demo\\max.xsl");
dic.Add("Arrayr", "c:\\demo\\r.xsl");
var list = dic.OrderBy(s => s.Value);
foreach (var s in list)
{
Console.WriteLine(dic[key]);
}
C#3.0 Linq (VS2008)的实现方法:
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("Arraymin", "c:\\demo\\min.xsl");
dic.Add("Arraymax", "c:\\demo\\max.xsl");
dic.Add("Arrayr", "c:\\demo\\r.xsl");
var dicSort = from d in dic
orderby d.Value
ascending
select d;
foreach (string key in dic.Keys)
{
Console.WriteLine(dic[key]);
}