-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backport] Add C# 9.0 record
support to serializer (#7108)
#7119
[Backport] Add C# 9.0 record
support to serializer (#7108)
#7119
Conversation
Co-authored-by: Oisin Grehan <oisin.grehan@hiloenergie.com>
806afeb
to
d6e1db4
Compare
This PR is contingent on #7121, so that should be merged first |
} | ||
|
||
[Serializable] | ||
public record ParamVal(int Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ReubenBond Does this mean records have to have the Serializable attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same rules apply for records as for other types: they don't need [Serializable]
if they directly appear in another serializable type or a grain interface method signature. I'd recommend adding [Serializable]
to any serializable type, though, since that is a more explicit way of telling the code generator to generate a serializer for a type.
* Upgrade SDK & fix projects * Add C# 9 record support to serializer (#7108) Co-authored-by: Oisin Grehan <oisin.grehan@hiloenergie.com> Co-authored-by: Oisin Grehan <oisin.grehan@hiloenergie.com>
Does one still have to use |
Records aren't necessarily immutable. They can have mutable fields or fields of mutable types (dictionary, list, etc). Note that you can annotate a type with |
Backport for 3.5.0
Backport of #7108