What's the role of GetHashCode in the IEqualityComparer in .NET?

前端 未结 3 2080
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 21:14

I\'m trying to understand the role of the GetHashCode method of the interface IEqualityComparer.

The following example is taken from MSDN:

using Syst         


        
3条回答
  •  离开以前
    2020-11-28 21:15

    GetHashCode is used in Dictionary colections and it creates hash for storing objects in it. Here is a nice article why and how to use IEqualtyComparer and GetHashCode http://dotnetperls.com/iequalitycomparer

提交回复
热议问题