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

前端 未结 6 780
离开以前
离开以前 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:05

    Use KeyValuePair as a wrapper class and then create a dictionary with to create a set perhaps? Or implement your own wrapper that overrides the Equals and GetHashCode.

    Dictionary mySet;
    
    for(int i = 0; i < keys.length; ++i)
    {
        KeyValuePair kvp = new KeyValuePair(keys[i], values[i]);
        mySet[kvp] = true;
    }
    

提交回复
热议问题