Hi, the easiest approach I know is a two-step algorithm: 1. sort the array or whatever collection you have; .NET knows how to do that. 2. iterate over the collection, and count how often an item is identical to the previous one. BTW: if you are not allowed to modify (i.e. sort) the original collection, you will need a helper collection, such as a HashTable/Dictionary, as others already explained. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.