Overloading operator== versus Equals()

前端 未结 6 857
生来不讨喜
生来不讨喜 2020-11-29 20:46

I\'m working on a C# project on which, until now, I\'ve used immutable objects and factories to ensure that objects of type Foo can always be compared for equal

6条回答
  •  囚心锁ツ
    2020-11-29 21:00

    According to Microsofts own best practises the outcome of the Equals method and the equals (==) overload should be the same.

    CA2224: Override equals on overloading operator equals

提交回复
热议问题