I often want to optimize the performance of a .Contains
on a collection.
I have always done this by creating a Dictionary<TKey,bool>
and then using .ContainsKey on the dictionary to give O(1) .Contains
performance.
However it always irks me that I actually don't care at all about the value in the dictionary.
Is there a better data structure than dictionary to support this case where I don't care about the actual value, only the existence of the key?