what is the fastest way to generate a unique set in .net 2

前端 未结 6 782
离开以前
离开以前 2021-01-12 21:46

I have what is essentially a jagged array of name value pairs - i need to generate a set of unique name values from this. the jagged array is approx 86,000 x 11 values. It d

6条回答
  •  礼貌的吻别
    2021-01-12 22:08

    Instead of using a Dictionary why not extend KeyedCollection? According to the documentation:

    Provides the abstract base class for a collection whose keys are embedded in the values.

    You then need to override the protected TKey GetKeyForItem(TItem item) function. As it is an hybrid between IList and IDictionary I think it's likely to be quite fast.

提交回复
热议问题