In the msdn guidance on Equals override, why the cast to object in the null check?

后端 未结 3 1235
南方客
南方客 2020-12-04 02:37

I was just looking at the Guidelines for Overloading Equals() on msdn (see code below); most of it is clear to me, but there is one line I don\'t get.

if ((S         


        
3条回答
  •  借酒劲吻你
    2020-12-04 02:59

    I suppose, since the article also talks about overriding operator==, that it's forcing it to use the == operator defined on Object rather than any overloaded operator in the current class.

提交回复
热议问题