IntelliTect / IntelliTect/CodingGuidelines

Document appropriate implementation of `GetHashCode`.

Offen
#8 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
documentation
Vorherrschende Sprache
C#
Sterne
12
Forks
16
Ø Merge
2 Min.
Gemergte PRs (30 T.)
7

Beschreibung

VS and Rider both flag warnings when you use a property in a `GetHashCode` implementation that is not read-only, however, I recently encountered an issue where one of the properties was virtual. This allowed the property to change in a derived class and alter the base class hash code leading to a failed dictionary lookup.

Solution: flag as warning when virtual member is used in `GetHashCode`

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.