หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
This code generation applies to:
- C#
What: Lets you generate Comparison operators for types that implement IComparable.
When: You have a type that implements IComparable we will automatically add the comparison operators.
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.
How-to
Place your cursor either inside the class or on the IComparable keyword.
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.