dictionary 用linQ排序
Dictionary<string, int> letterWordTotalNum = wordsMrg.GetAllLetterTotalNum(); var dicSort = from d in letterWordTotalNum orderby d.Key select d; foreach (string key in dicSort.Keys) { s Response.Write(dicSort[key] + "<br />"); } 按key进行升序排列,如需将序排列,则 orderby d.Key descending,排序之后仍然是一个键值对的集合。