gpt4 book ai didi

c# - Equals Method 的默认行为是什么?

转载 作者:IT王子 更新时间:2023-10-29 04:00:02 26 4
gpt4 key购买 nike

设 A 是一个类,其中一些成员为 x、y、z:

Class A {
int x;
int y;
String z;
...
}

A 是一个对象,因此它继承了对象中定义的“等于”函数。这个函数的默认行为是什么?它是检查成员的相等性还是检查引用的相等性?

最佳答案

The default implementation of Equals supports reference equality for reference types, and bitwise equality for value types. Reference equality means the object references that are compared refer to the same object. Bitwise equality means the objects that are compared have the same binary representation.

http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx

关于c# - Equals Method 的默认行为是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2632369/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com