Answers for "int array to frequency dictionary c#"

C#
0

int array to frequency dictionary c#

var frequency = myList.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
Posted by: Guest on November-14-2020
0

int array to frequency dictionary c#

using System.Linq;

List<int> ids = //

foreach(var grp in ids.GroupBy(i => i))
{
    Console.WriteLine("{0} : {1}", grp.Key, grp.Count());
}
Posted by: Guest on November-14-2020

C# Answers by Framework

Browse Popular Code Answers by Language