Equals()のオーバーライド
public class Foo : IEquatable<Foo> { public override bool Equals(object other) { // nullチェック if (object.ReferenceEquals.(other, null)) { return false; } if (object.ReferenceEquals(this, other)) { return true; } if (this.GetType() != other.GetType()) { return false; } return Equals((Foo)other); } #region IEquatable<Foo> メンバー public bool Equals(Foo other) { // ここにFooの同値比較の処理(省略) return true; } #endregion }