KeyNotFoundException in filled dictionary

后端 未结 2 1991

I am trying to modify value in dictionary, but the compiler throws KeyNotFoundException. I\'m sure, I declared that key in dictionary, because I am calling

2条回答
  •  粉色の甜心
    2020-12-21 12:18

    Dictionary is using the GetHashCode and Equals for key comparisons, so implementing the IComparable interface is not enough. Have a look at this answer, that's exactly what you need.

提交回复
热议问题