Generate a default '==' for struct types that haven't explicitly defined it #7654
-
I believe that the current method of equality comparison is outdated and should be replaced with
This way, you can confidently compare any two objects of the same type, and in most cases, the default implementation should meet the requirements and offer good performance.
In this example, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
.Equals is literally the way to do equality for .net and has been for literally 25 years. It works well, as designed, and is not something we have any desire to change. If it ain't broke, don't fix it. |
Beta Was this translation helpful? Give feedback.
-
This would be a significant breaking change. Existing code that depended on the current behaviour would now give different results. Regardless of whether the change makes the code _more correct) or not (and that's a point that would be vehemently argued), the fact it would break existing code for nebulous benefit makes this a non-starter. |
Beta Was this translation helpful? Give feedback.
.Equals is literally the way to do equality for .net and has been for literally 25 years. It works well, as designed, and is not something we have any desire to change. If it ain't broke, don't fix it.