Answer the question
In order to leave comments, you need to log in
Gentlemen, how to return the result of processing in this C # + linq snippet?
var a = new[] { 11, 11, 23, 23, 23, 23, 23, 44, 88, 88 };
var g = a
.GroupBy(i => i) // сгруппировали
.Select(i => i.First()) // взяли первый элемент группы
.OrderByDescending(i => i) // отсортировали по убыванию
.ToList();
var count = g.Count;
11 (2)
23 (5)
44 (1)
88 (2)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question