Dictionary with integer array as a key

后端 未结 3 689
忘掉有多难
忘掉有多难 2020-12-20 08:34

I need a Dictionary whose key is an array of integers for example Dictionary or

Dictionary,string>.
<         


        
3条回答
  •  难免孤独
    2020-12-20 08:59

    It isn't predefined because it is expensive. If you know your list is short then just implement the obvious overrides. If not, you'll have to come up with some kind of heuristic for at least GetHashCode. Say, GetHashCode of only the first couple of elements xor-ed together with the Length.

提交回复
热议问题