Is it necessary to override == and != operators when overriding the Equals method? (.NET)

后端 未结 9 1247
一向
一向 2021-01-11 19:06

Or it\'s advisable to do that? Why?

9条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-11 19:23

    If you are overriding the equals method and still want to be able to check for equality (or inequality) then you should probably override the == and != methods as well.

提交回复
热议问题