All rules
IDE0250Language rules (modifier preferences)
Struct can be made 'readonly'
Struct can be made 'readonly'
Microsoft docsDescription
This rule flags structs that aren't marked readonly when all their members are marked readonly.
Example
// Code with violations.
struct S
{
readonly int i;
}
// Fixed code.
readonly struct S
{
readonly int i;
}Configurable options
Vote for the value each option should take in the generated .editorconfig.
csharp_style_prefer_readonly_struct default:
trueYour vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0