I have an array which contains the following results
red red red blue blue Green White Grey
and I want to get duplicate count of every val
LINQ makes this easy:
Dictionary counts = array.GroupBy(x => x) .ToDictionary(g => g.Key, g => g.Count());