OrderingRules.md

February 11, 2016 ยท View on GitHub

Ordering Rules (SA1200-)

Rules which enforce a standard ordering scheme for code contents.

IdentifierNameDescription
SA1200UsingDirectivesMustBePlacedCorrectlyA C# using directive is placed outside of a namespace element.
SA1201ElementsMustAppearInTheCorrectOrderAn element within a C# code file is out of order in relation to the other elements in the code.
SA1202ElementsMustBeOrderedByAccessAn element within a C# code file is out of order within regard to access level, in relation to other elements in the code.
SA1203ConstantsMustAppearBeforeFieldsA constant field is placed beneath a non-constant field.
SA1204StaticElementsMustAppearBeforeInstanceElementsA static element is positioned beneath an instance element of the same type.
SA1205PartialElementsMustDeclareAccessThe partial element does not have an access modifier defined.
SA1206DeclarationKeywordsMustFollowOrderThe keywords within the declaration of an element do not follow a standard ordering scheme.
SA1207ProtectedMustComeBeforeInternalThe keyword protected is positioned after the keyword internal within the declaration of a protected internal C# element.
SA1208SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectivesA using directive which declares a member of the System namespace appears after a using directive which declares a member of a different namespace, within a C# code file.
SA1209UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectivesA using-alias directive is positioned before a regular using directive.
SA1210UsingDirectivesMustBeOrderedAlphabeticallyByNamespaceThe using directives within a C# code file are not sorted alphabetically by namespace.
SA1211UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasNameThe using-alias directives within a C# code file are not sorted alphabetically by alias name.
SA1212PropertyAccessorsMustFollowOrderA get accessor appears after a set accessor within a property or indexer.
SA1213EventAccessorsMustFollowOrderAn add accessor appears after a remove accessor within an event.
SA1214ReadonlyElementsMustAppearBeforeNonReadonlyElementsA readonly field is positioned beneath a non-readonly field.
SA1215InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElementsAn instance readonly element is positioned beneath an instance non-readonly element of the same type.
SA1216UsingStaticDirectivesMustBePlacedAtTheCorrectLocationA using static directive is positioned at the wrong location (before a regular using directive or after an alias using directive).
SA1217UsingStaticDirectivesMustBeOrderedAlphabeticallyThe using static directives within a C# code file are not sorted alphabetically by full type name.