Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
This code generation applies to:
- C#
What: Lets you generate Equals and IEquatable operators for structs.
When: You have a struct we will automatically add the IEquatable as well as the equals and not equals operators for you.
Why:
If you are implementing a value type, you should consider overriding the Equals method to gain increased performance over the default implementation of the Equals method on ValueType.
Implement IEquatable interface implements a type-specific Equals() method.
How-to
Place your cursor somewhere on the line of your struct declaration.
Next, do one of the following:
Press Ctrl+. to trigger the Quick Actions and Refactorings menu.
Right-click and select the Quick Actions and Refactorings menu.
Click the
icon that appears in the left margin.

Select Generate Equals(object) from the drop-down menu.