文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C# 中使用Linq 对Dictionary进行排序

C# 中使用Linq 对Dictionary进行排序

时间:2011-05-08  来源:泪的诺言lni

                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,排序之后仍然是一个键值对的集合。

相关阅读 更多 +
排行榜 更多 +
方块枪战战场安卓版

方块枪战战场安卓版

飞行射击 下载
战斗火力射击安卓版

战斗火力射击安卓版

飞行射击 下载
空中防御战安卓版

空中防御战安卓版

飞行射击 下载