If the interface inherits IEquatable, the implementing class can determine the behavior of the Equals method. Is it possible to determine the behavior of == operations?
public interface IFoo : IEquatable
{}
public class Foo : IFoo
{
public bool Equals(IFoo other)
{
}
}
To verify that two IFoo references are equal by comparing their values:
IFoo X = new Foo();
IFoo Y = new Foo();
if (X.Equals(Y))
{
}
Can I use if (X == Y)the Equals method on Foo?
source
share