Information Technology Reference
In-Depth Information
if ( object .ReferenceEquals(right, null ))
return false ;
// Check reference equality:
if ( object .ReferenceEquals( this , right))
return true ;
// Problems here, discussed below.
B rightAsB = right as B ;
if (rightAsB == null )
return false ;
return this .Equals(rightAsB);
}
#region IEquatable<B> Members
public bool Equals( B other)
{
// elided
return true ;
}
#endregion
}
public class D : B , IEquatable < D >
{
// etc.
public override bool Equals( object right)
{
// check null:
if ( object .ReferenceEquals(right, null ))
return false ;
if ( object .ReferenceEquals( this , right))
return true ;
// Problems here.
D rightAsD = right as D ;
Search WWH ::




Custom Search