We have multitudes of structs being non-readonly, and making them readonly would be a breaking change. As some of these structs may be used with the in modifier in user code they will be defensively copied each time a member is accessed or a function is called on the struct. The new c# 8 feature, readonly members allows the compiler to ellide the defensive copy when accessing readonly members. We have tons of places where we easily make these changes without breaking anything (GetHashCode and Equals on structs should NEVER mutate them). This is a mirror of the ticket here
We have multitudes of structs being non-readonly, and making them readonly would be a breaking change. As some of these structs may be used with the in modifier in user code they will be defensively copied each time a member is accessed or a function is called on the struct. The new c# 8 feature, readonly members allows the compiler to ellide the defensive copy when accessing readonly members. We have tons of places where we easily make these changes without breaking anything (GetHashCode and Equals on structs should NEVER mutate them). This is a mirror of the ticket here