ReSharper Web Help

To create stub overrides for Equals() and GetHashCode() methods
  1. In the editor, position the caret within a class.
  2. On the main menu, choose ReSharper | Edit | Generate Code, or press Alt+Insert.
  3. From the Generate pop-up menu, select Equality members.
  4. On the Generate equality members page of the Generate wizard, select fields to be compared with the Equals() method.
    Generate Equality Members
    Optionally, use the following controls:
    • Fields can be null includes nullity check for every participating type member into the expression that the overridden GetHashCode() method returns (to configure nullity check for specific members, click Advanced).
    • GetHashCode already exists and Equals already exists let you indicate whether to:
      • Replace the corresponding override if it already exists.
      • Put the newly generated override side by side with the existing override.
      • Skip generating a new override altogether.
    • Equality operators generates custom equality and inequality operators in the current type.
    • Implement IEquatable<T> interface implements a type-specific Equals() method.
    • Copy XML documentation copies documentation from all overridden members to all overriding members (to specify whether documentation should be copied for every individual member, click Advanced).
  5. Do one of the following:
    • To configure nullity and XML documentation options individually for specific members, click Advanced. After finishing this step, click Next.
    • Click Finish to complete the wizard.


You can also generate the two overrides by choosing Overriding Members in the Generate menu, but if you do so, they will both return base methods.

See Also