C# Feature – File-scoped namespaces
Overview
Section titled “Overview”Use a semicolon after namespace to scope the entire file, avoiding an extra block and indentation.
Introduced In
Section titled “Introduced In”C# 10 (2021)
Before
Section titled “Before”namespace MyApp{ class C {}}namespace MyApp;class C {}Gotchas & Best Practices
Section titled “Gotchas & Best Practices”- One file-scoped namespace per file.