65.9K
CodeProject is changing. Read more.
Home

Using GetHashCode correctly

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Oct 12, 2011

CPOL

2 min read

viewsIcon

9970

Assuming you are writing a class (not a struct), you can basically get a fixed random hashcode simply by NOT overriding GetHashCode() but inheriting the implementation from System.Object. Unfortunately the System.Object implementation is not documented in the standard .NET documentation[^] but I...