Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
値を含む文字列配列があります(当然...)。
最も多く発生するエントリを取得する簡単な方法はありますか? 何かのようなもの
values[37].getMostOften();
乾杯 :)
使用できますGroupBy:
GroupBy
var mostCommonValue = values.GroupBy(v => v) .OrderByDescending(g => g.Count()) .Select(g => g.Key) .FirstOrDefault();