== Why is this an issue?

The ``++IEquatable<T>++`` interface has only one method in it: ``++Equals(<T>)++``. If you've already written ``++Equals(T)++``, there's no reason not to explicitly implement ``++IEquatable<T>++``. Doing so expands the utility of your class by allowing it to be used where an ``++IEquatable++`` is called for.


**Note**: Classes that implement ``++IEquatable<T>++`` should also be ``++sealed++``.


=== Noncompliant code example

[source,csharp]
----
class MyClass  // Noncompliant
{
  public bool Equals(MyClass other)
  {
    //...
  }
}
----


=== Compliant solution

[source,csharp]
----
sealed class MyClass : IEquatable<MyClass>
{
  public override bool Equals(object other)
  {
    return Equals(other as MyClass);
  }

  public bool Equals(MyClass other) 
  {
    //...
  }
}
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Implement 'IEquatable<XXX>'.


=== Highlighting

* primary: class declaration
* secondary: Equals signature


'''
== Comments And Links
(visible only on this page)

=== on 6 Mar 2017, 18:12:37 Ann Campbell wrote:
Updated as discussed [~amaury.leve].  Please double-check me.

=== on 7 Mar 2017, 10:02:09 Amaury Levé wrote:
\[~ann.campbell.2] Done!

endif::env-github,rspecator-view[]
