LINQ с GROUP BY - C#
Формулировка задачи:
Объясните как это работает? вот тут есть статья в ней такой пример
Как работает group by тут? Объясните код пожалуйста)
string s = "LINQ is a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.";
var res = from n in s.ToLower().ToCharArray()
group n by n into g
let count = g.Count()
orderby count descending
select new
{
Letter = g.Key,
Count = count
};
foreach (var item in res)
{
Console.WriteLine(item);
}Решение задачи: «LINQ с GROUP BY»
textual
Листинг программы
Key1 Key: Key1, Name: Item1 Key2 Key: Key2, Name: Item2 Key: Key2, Name: Item4 Key3 Key: Key3, Name: Item3 Key: Key3, Name: Item5