Skip to content

IEquatable

Michael Damatov edited this page Jan 17, 2024 · 1 revision

Suggests to declare an implementation of the IEqualityOperators<T, T, bool> interface

Applies to

  • Non-nested classes that already implements the IEquatable<T> interface.
  • Non-nested structs that already implements the IEquatable<T> interface.
  • Non-nested records.

💡 A context action is always available to declare an implementation of the IEqualityOperators<T, T, bool> interface.

Note

The analyzer is only active when C# 11 or higher is used with the framework, which has the IEqualityOperators<TSelf,TOther,TResult> interface.

💡 The analyzer can be deactivated in the ReSharper Options dialog.

Warns when a struct overrides Equals without implementing the IEquatable<T> interface

Applies to

  • Structs

References

Warns when a type implements the IEquatable<T> interface without overring Equals

Applies to

  • Classes
  • Structs

References