Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.28 KB

SA1210.md

File metadata and controls

39 lines (29 loc) · 1.28 KB

SA1210

TypeName SA1210UsingDirectivesMustBeOrderedAlphabeticallyByNamespace
CheckId SA1210
Category Ordering Rules

Cause

The using directives within a C# code file are not sorted alphabetically by namespace.

Rule description

A violation of this rule occurs when the using directives are not sorted alphabetically by namespace. Sorting the using directives alphabetically makes the code cleaner and easier to read, and can help make it easier to identify the namespaces that are being used by the code. The System namespaces are an exception to this rule and will always precede all other namespaces. See SA1208 for more details.

How to fix violations

To fix an instance of this violation, order the using directives alphabetically by namespace with all the System namespace entries first.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1210:UsingDirectivesMustBeOrderedAlphabeticallyByNamespace", Justification = "Reviewed.")]
#pragma warning disable SA1210 // UsingDirectivesMustBeOrderedAlphabeticallyByNamespace
#pragma warning restore SA1210 // UsingDirectivesMustBeOrderedAlphabeticallyByNamespace