Override GetHashCode when override Equals

It is a good practice to always override GetHashCode when you override Equals. In case of references types it is a must, otherwise Dictionary will not be able to find an equal item, because hashCode is checked first. In case of valueTypes like the struct in the lecture, it is optional, yet still better to override it, because the default implementation uses reflection and is slower - Beware of implicit boxing of value types | theburningmonk.com.

Privacy & Terms