Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • GetHashCode is missing a return. Commented Dec 16, 2014 at 18:45
  • 1
    Quick note: As the answer hints at, you should not use this Comparer. The equals method is sensitive to order but the hash method is not. Commented Jun 16, 2016 at 19:35
  • You can use StructuralComparisons class (since .NET 4.0 and Visual Studio 2010), see this answer. Commented Feb 2, 2019 at 10:39
  • Starting from .NET Core 2.1 or .NET Framework 4.6.1, you can use System.HashCode, which might be better than implementing your own hash. See this answer. Commented Jul 30, 2021 at 9:04