Skip to content

Conversation

pkulikov
Copy link
Contributor

Contributes to #20585

@BillWagner as for the further work on records, could you please check #20585 (comment)


### Record types equality

Available in C# 9.0 and later, [record types](../../whats-new/csharp-9.md#record-types) support the `==` and `!=` operators that by default provide value equality semantics. That is, two record operands are equal when both of them are non-null and corresponding values of all fields and auto-implemented properties are equal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By reading this, one will assume that two records are not equal if both are null, which is incorrect.

https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQxAgrgOwD4EEAEEAjPgLz6boA2VA3ALABQBEATGRdXUwAJEB0fAJwAKYmXJsAlA0ZMEcAMYB7BABN8uWkA=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I need to check this, thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youssef1313 thanks again, I've fixed the text.

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM @pkulikov

Thanks again for your help on the reference for C# 9! 🎆

I'll :shipit: now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants