JetBrains Rider 2024.1 Help

Code Inspection: Use preferred namespace body style

Category

Syntax Style

ID

ArrangeNamespaceBody

EditorConfig

resharper_arrange_namespace_body_highlighting

Default severity

Hint

Language

C#

Requires SWA

No

Starting from C# 10, you can use file-scoped namespace declarations in files containing a single namespace.

If you prefer to stick to either file-scoped or block-scoped namespace declarations, JetBrains Rider lets you configure your preferences and maintain the consistency of your preferences throughout your codebase.

For example, if you prefer having file-scoped namespaces, JetBrains Rider suggests the quick-fix To file-scoped namespace if there is a single namespace declaration in a file.

using System; namespace MyNamespace { class MyClass { } }
namespace MyNamespace; using System; class MyClass { }
Last modified: 10 April 2024