Convert a file to use .NET file-scoped namespaces with Visual Studio refactor

Did you know… in Visual Studio we can convert a class file to use .NET file-scoped namespaces by adding a semi-colon at the end of the namespace as seen on line 3 below 💪 …

File-scoped namespaces was a new feature in C# 10 / .NET 6 and allows us to remove one level of indentation in our code which can help improve readability.

Leave a Reply

Your email address will not be published. Required fields are marked *