| TypeName | SA1217UsingStaticDirectivesMustBeOrderedAlphabetically |
| CheckId | SA1217 |
| Category | Ordering Rules |
📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.
The using static directives within a C# code file are not sorted alphabetically by full type name.
A violation of this rule occurs when the using static directives are not sorted alphabetically by full type name. Sorting the using static directives alphabetically makes the code cleaner and easier to read.
Global using directives (C# 10) are analyzed independently from local using directives. Diagnostics and fixes compare only directives which both use, or both omit, the global modifier.
To fix an instance of this violation, order the using static directives alphabetically by full type name.
#pragma warning disable SA1217 // Using static directives should be ordered alphabetically
using static System.Math;
#pragma warning restore SA1217 // Using static directives should be ordered alphabetically