Closed brcrista closed 3 years ago
I tested this out and it works as you'd expect. IEquatable<T>
looks like:
public interface IEquatable<T>
{
bool Equals(T? obj);
}
So, IEquatable<T?>
looks exactly the same, and you can implement it without additional modifications. But, if you have a method that takes a parameter of type IEquatable<T?>
and you only implement IEquatable<T>
, you'll get a warning.
On the other hand, you can assign an IEquatable<T?>
to an IEquatable<T>
just fine.
According to the guidance at https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/api-guidelines/nullability.md#interface-implementations
IComparable<T>
Token<T>
IEquatable<T>
Either
Of<T>
Optional
(value type)Result
Token<T>
Unit
(value type)