int array to frequency dictionary csharp

Code Example - int array to frequency dictionary csharp

                
                        using System.Linq;

List<int> ids = //

foreach(var grp in ids.GroupBy(i => i))
{
    Console.WriteLine("{0} : {1}", grp.Key, grp.Count());
}