In C# 9 we saw how top-level statements can help us reduce ‘wasted’ vertical space…
![](https://csharp.academy/wp-content/uploads/2024/06/Use-file-level-namespaces-in-C-10-to-reduce-vertical-nesting.png)
BUT… reducing ‘wasted’ horizontal space and in particular nesting levels is much more valuable IMHO and in C# 10 (released November 2021) we have file-level namespaces to help with this.
File-level namespaces are definitely one of my favourite features from C# 10 and Milan Jovanović’s example (originally posted on LinkedIn) below shows what they look like…
![](https://csharp.academy/wp-content/uploads/2024/06/Use-file-level-namespaces-in-C-10-to-reduce-vertical-nesting.jpg)
Another approach to reducing nesting levels is to use guard clauses.