You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit makes it more clear the implementing class of the `IEquatable<T>` method must be of type `T ` in order to be able to determine if its equal to other instances of type `T`.
Confusion might arise in certain case. For example, if we have a class of type `MyClass` that implements `IEquatable<MyOtherClass>`, then we can't use `IEquatable`'s method `Equals` to compare an instance of `MyClass` with another instance of `MyClass`
Copy file name to clipboardExpand all lines: docs/csharp/fundamentals/types/interfaces.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ You define an interface by using the [`interface`](../../language-reference/keyw
18
18
19
19
The name of an interface must be a valid C# [identifier name](../coding-style/identifier-names.md). By convention, interface names begin with a capital `I`.
20
20
21
-
Any class or struct that implements the <xref:System.IEquatable%601> interface must contain a definition for an <xref:System.IEquatable%601.Equals%2A> method that matches the signature that the interface specifies. As a result, you can count on a class that implements `IEquatable<T>` to contain an `Equals` method with which an instance of the class can determine whether it's equal to another instance of the same class.
21
+
Any class or struct that implements the <xref:System.IEquatable%601> interface must contain a definition for an <xref:System.IEquatable%601.Equals%2A> method that matches the signature that the interface specifies. As a result, you can count on a class of type `T`that implements `IEquatable<T>` to contain an `Equals` method with which an instance of this class can determine whether it's equal to another instance of the same class.
22
22
23
23
The definition of `IEquatable<T>` doesn't provide an implementation for `Equals`. A class or struct can implement multiple interfaces, but a class can only inherit from a single class.
0 commit comments