I need to have an ability to have unique items in a collection.
I was going to use a Dictionary so I could use the ContainsKey method but I thought it would be a waste as I wouldnt use the Value property of the Key/Value pair.
I came across the HashSet<T>
which looks very promising. The only thing I can find that I can't find in the List<T>
docs is that HashSet<T>
is unordered. I think that is fine, I assume it means its not ordered using a IEqualityComparer
. As long as the order in which items are added are in the same index position I think it will be ok as I have to do duplicate checking hence the hashset and then check all entries are sequential.
Is there anything else I have missed comparing the two types?