What does SA1200 mean for StyleCop?

Asked 2 years ago, Updated 2 years ago, 71 views

Typically, the using directive is written outside of namespace (at the beginning of the file), but StyleCop generates the following warning:What does this mean?

SA1200:CSharp.Ordering: All using directives must be placed inside of the name space.

c# visual-studio

2022-09-30 20:35

2 Answers

The SA1200 is subject to warnings for two reasons:

For more information, see the StyleCott SA1200 document.


2022-09-30 20:35

If the alias is used in using as mentioned in the following Blog article and the alias is used without a namespace, the problem is that if the alias is outside the namespace, the compilation error will not be found and the bug will not be found.

Stylistic differences in using-I know the answer(it's42)-Site Home-MSDN Blogs

However, I don't see many codes that MS recently released as OSS that have this rule applied to them, so I think it's okay to remove this rule gently.

However, if you want to use an alias-intensive coding style, it might be safer to set it up.


2022-09-30 20:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.