Question: I have an array of Customer[] objects, and I want to use it to create a Dictionary<Customer, string>. What is the easiest way to examine the array for duplicates before I load the Dictionary? I want to avoid "ArgumentException: An item with the same key has already been added". Thanks.

Answer: 
How big is the array? and how likely is it that there will be duplicates?

Checking each element of the array against all the others is quite a expensive operation.

It would be quicker to call `Dictionary.ContainsKey(key)` before adding each item.

**NOTE:** If duplicates are rare then you could use exception handling, but that's bad programming practice.
What is your definition of duplicate in this case? 

If its simply the same object instance (the same pointer) then that's simple, you can use any of the methods in the other answers given here. 

Sometimes though the concept of equality is not so straight forward, is a different object instance with the ***same data*** equal? In that case you probably want an implementation of an IEqualityComparer to help you.