I\'m looking for something like a Dictionary
There actually is one, which is generic and has been around since .net 2.0. It's called KeyedCollectionKeyedCollection as a workaround).
If you need it as an IDictionary, it has a .Dictionary property.
A somewhat minor issue that I have with it is that it is an abstract class and you have to subclass it and implement:
protected abstract TKey GetKeyForItem(TItem item)
I'd rather just pass a lambda into the constructor for this purpose, but then again, I guess a virtual method is slightly faster than a lambda (any comments on this appreciated).
Edit As the question came up in the comments: KeyedCollection preserves order, as it inherits from CollectionIList. See also the documentation of the Add method: Adds an object to the end of the Collection.).