A KeyedCollection contains both a list and a dictionary with the same items, and serializes both. Tests show that this takes almost twice as long as it needs to and results in a serialization stream that is 30% bigger.
To avoid this, the private field "private Dictionary<TKey, TItem> dict;" ought to be marked with the NonSerialized attribute.
As a consequence, a few members (Contains, AddKey, ContainsItem, Item) will need code
added to recreate the dictionary if it does not exist (following deserialization), something like:
if ((dict == null) && (this.keyCount >= this.threshold))