Use byte[] as key in dictionary

前端 未结 7 1565
南旧
南旧 2020-12-28 12:11

I need to use a byte[] as a key in a Dictionary. Since byte[] doesn\'t override the default GetHashCode method, two sepa

7条回答
  •  囚心锁ツ
    2020-12-28 12:42

    Your thought was my first thought as well. I don't think that it would be error prone. But if you don't like that option you could create a class that implements IEqualityComparer and pass an instance of it to the Dictionary's constructor.

提交回复
热议问题