All pastes #292068 Raw Edit

Mine

public text v1 · immutable
#292068 ·published 2006-12-26 02:56 UTC
rendered paste body
// I create this class
BoundingFrustum f= new BoundingFrustum(new Matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2));

// I compare it to itself
f.Equals(f)

// I enter this method
public bool Equals(BoundingFrustum other)
{
    // Other is *not* null, therefore it should go to this.matrix.Equals(other.matrix)
    return (other == null) ? false : this.matrix.Equals(other.matrix);
}

// However i end up in this method (in the BoundingFrustum class)
public static bool operator == (BoundingFrustum a, BoundingFrustum b)
{
    // Here "b" is equal to null
    return a.Equals(b);
}

// So that method calls into here again:
public bool Equals(BoundingFrustum other)
{
    // This returns false as "other" is null this time
    return (other == null) ? false : this.matrix.Equals(other.matrix);
}

// But this (wierdly enough) bounces me back out to the op_equality again, with both a and b equal to null
public static bool operator == (BoundingFrustum a, BoundingFrustum b)
{
    // I get a NullReferenceException here as both a and b are now null
    return a.Equals(b);
}