How to change your C# class template in Visual Studio 2022 to use the new file scoped namespaces

Posted on by  
Alexander Chatzizacharias

In C# version 10, support for file scoped namespaces was added. This allows us to eliminate more boilerplate from our classes and also get rid of some extra unneeded identation. Unfortunately, when you create a new C# class in Visual Studio 2022, the template still uses the old namespace declaration style. I don’t like that, and if you found this blogpost, neither do you!

Thankfully, changing this is not hard.

Continue reading →