Where is == operator defined in Class “object”?

前端 未结 4 1113
渐次进展
渐次进展 2021-02-05 00:46

I searched the source code of FCL, and I got confused that string.Equals() uses Object.ReferenceEquals(), and Object.ReferenceEquals() use

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 01:10

    ceq takes two values from the stack and gives results. If the result value is 1 then they are considered equal and 0 if they are not equal.

    However, the == operator doesn't always get translated to ceq. Whether == in C# results in ceq depends on some more factors like are data types primitives or do they have custom == operators or are they references.

提交回复
热议问题