Skip to content

Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

ReviewInconsistentIdentityRule

Assembly: Gendarme.Rules.Correctness
Version: git

Description

This rule checks to see if a type manages its identity in a consistent way. It checks:

  • Equals methods, relational operators and CompareTo must either use the same set of fields and properties or call a helper method.
  • GetHashCode must use the same or a subset of the fields used by the equality methods or call a helper method.
  • Clone must use the same or a superset of the fields used by the equality methods or call a helper method.

Examples

Notes

  • This rule is available since Gendarme 2.4

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally