Friday, February 4, 2022

Visual Studio 17.1 Preview 5: Streamlined File Scoped Namespacing

This is a quick post on a very nice feature that got introduced with Visual Studio Version 17.1.0 Preview 5.0 (released on February 1, 2022).

I am using .NET 6/C# 10.0 in most of my projects and I have been updating the source files to use File Scoped Namespaces. I have been adding a semicolon at the end of the namespace name and then I had to manually delete unnecessary curly braces. And that was tiring. 

Converting to File Scoped Namespaces

But I no longer have to do that, Hooray! With the Visual Studio Version 17.1.0 Preview 5.0, I can just add the semicolon at the end of the namespace name, and Visual Studio takes care of the rest automatically. I just love this!

If you are planning on migrating your code to use File Scoped Namespaces, I would highly recommend doing so with the latest Visual Studio 2022 Preview, it's going to save you a lot of time.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment