Description
This rule lets you enforce a desired modifier sort order.
- When this rule is enabled and the associated options are set to a list of modifiers, prefer the specified ordering.
- When this rule is not enabled, no specific modifier order is preferred.
Example
// csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
class MyClass
{
private static readonly int _daysInYear = 365;
}Configurable options
Vote for the value each option should take in the generated .editorconfig.
csharp_preferred_modifier_order default:
public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, asyncvisual_basic_preferred_modifier_order default:
Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, AsyncYour vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0