An object in C# has four methods – {Equals, GetType, ToString, GetHashCode}.
What sort of useful thing could someone do with the hash-code?
An object in C# has four methods – { Equals , GetType , ToString
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Quickly find potentially equal objects.
In particular, this method is usually used by types such as
Dictionary<TKey, TValue>(for the keys) andHashSet<T>.You should not assume that objects with equal hash codes are equal, however. See Eric Lippert’s blog post for more information, and the Wikipedia hash table page for a more general discussion on the uses of hash codes.