((System.Object)p == null)

Posted by Daniel Bryars on Stack Overflow See other posts from Stack Overflow or by Daniel Bryars
Published on 2010-05-25T21:34:38Z Indexed on 2010/05/25 21:41 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

Why do this:

    // If parameter cannot be cast to Point return false.
    TwoDPoint p = obj as TwoDPoint;
    if ((System.Object)p == null)
    {
        return false;
    }

Instead of this:

    // If parameter cannot be cast to Point return false.
    TwoDPoint p = obj as TwoDPoint;
    if (p == null)
    {
        return false;
    }

I don't understand why you'd ever write ((System.Object)p)?

Regards,

Dan

© Stack Overflow or respective owner

Related posts about c#

Related posts about class