TypeName | SA1216UsingStaticDirectivesMustBePlacedAtTheCorrectLocation |
CheckId | SA1216 |
Category | Ordering Rules |
📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.
A using static
directive is positioned at the wrong location (before a regular using directive or after an alias using directive).
A violation of this rule occurs when a using static directive is placed before a normal or after an alias using directive. Placing the using static directives together below normal and before alias using-directives can make the code cleaner and easier to read, and can help make it easier to identify the static members used throughout the code.
The fix an instance of this violation, place the using static
directive after regular and before alias using directives.
#pragma warning disable SA1216 // Using static directives should be placed at the correct location
using static System.Math;
#pragma warning restore SA1216 // Using static directives should be placed at the correct location