Code syntax style: file-scoped namespaces

Last modified: 11 February 2024

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, ReSharper lets you configure your preferences and maintain the consistency of your preferences throughout your codebase.

ReSharper helps you enforce preferences for file-scoped namespaces in the existing code and takes your preferences into account when it produces new code with code completion and code generation features, applies code templates and performs refactorings.

This feature is supported in the following languages and technologies: