字典中的第一项

FSm*_*FSm 0 c# c#-4.0

我有一个按降序排序的字典.每个字符串(键)是一个术语,int(值)是它的计数.我如何得到第一个计数?因为它指的是最大数量(频率).......提前感谢.

Just to inform some of whom commented that the dictionary<string,int> will change its
rank. Be sure, if you are grouping  the dictionary by its count, there is no problem  
with the order . Always the dictionary will come with highest count at first.
Run Code Online (Sandbox Code Playgroud)

the*_*oop 6

'字典按降序排序'是什么意思?A Dictionary<TKey,TValue>的定义是未分类的!你的意思是SortedDictionary<TKey,TValue>?如果是这样,您可以使用:

var firstCount = sortedDictionary.First().Value;
Run Code Online (Sandbox Code Playgroud)