Ghi
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử thay đổi thư mục.
'class' overrides Object.Equals(object o) but does not override Object.GetHashCode()
The compiler detected an override of the Object.Equals method but no override of the Object.GetHashCode method. An override of Equals implies that you also want to override GetHashCode.
The following code generates CS0659:
// CS0659.cs
// compile with: /W:3 /target:library
class Test
{
public override bool Equals(object o) { return true; } // CS0659
}
// OK
class Test2
{
public override bool Equals(object o) { return true; }
public override int GetHashCode() { return 0; }
}
See also
Cộng tác với chúng tôi trên GitHub
Bạn có thể tìm thấy nguồn cho nội dung này trên GitHub, nơi bạn cũng có thể tạo và xem xét các vấn đề cũng như yêu cầu kéo. Để biết thêm thông tin, hãy xem hướng dẫn cộng tác viên của chúng tôi.