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
Hmm That is a very hard task, but Captain Algorithm will help you! He is telling us that there are many ways to do this. One of them he give me and I give it to you:
Dictionary tmp = new Dictionary (); foreach (Object obj in YourArray) if (!tmp.ContainsKey(obj)) tmp.Add (obj, 1); else tmp[obj] ++; tmp.Values;//Contains counts of elements