-
Notifications
You must be signed in to change notification settings - Fork 168
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
readonly struct #120
Comments
I haven't really used |
@mcintyre321, you can read more here: https://devblogs.microsoft.com/premier-developer/avoiding-struct-and-readonly-reference-performance-pitfalls-with-errorprone-net/ tldr; if struct is not private readonly OneOf<MyStruct1, MyStruct2> _value = new MyStruct1(); In the example above |
The initial ask was completed by #129. |
Since all fields of the OneOf struct are readonly, can we also mark the struct readonly using the keyword in its declaration?
I was surprised to discover this has not already happened and suspect you have a good reason. I'm looking to improve performance in method calls by passing the struct with the
in
keyword.The text was updated successfully, but these errors were encountered: