More Readable C# Code with File-Scoped Namespaces in .NET 6

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
With file scoped namespaces you can reduce a level of indentation, making your class files more readable. So here you have a typical class file. In C# you have you using statements at the top. Then you have the namespaces with the opening bracket and then the level of indentation and then your class or all the other stuff, right? That just clutters your code because the namespace is always there. It's always going to have that level of indentation. So now, as a C# 10, you can remove that level of indentation. And there's a little Visual Studio trick to help you. You can just type a semicolon at the end of the namespaces to help you convert it file scoped namespaces that doesn't work, remove the braces yourself and add that little semicolon and it should be the exact same. Now your class files will look much less cluttered and your code will become cleaner automatically making you a better developer. Or not. Please like and subscribe this video for more.
Info
Channel: Gerald Versluis
Views: 3,794
Rating: undefined out of 5
Keywords: c# 10, .net 6, c# tutorial, visual studio 2022, c# namespaces, file scoped namespace, file scoped namespaces in c# 10, file scoped namespaces in c#, .net 6 features, file scoped namespaces, c# namespace, c# 10 new features, .net core, c# 101, .net tutorial, c# 10 tutorial, c# 10 namespace, namespaces in c#.net, file scoped namespaces visual studio 2022, File-Scoped Namespaces
Id: MASYQ4fffkM
Channel Id: undefined
Length: 0min 48sec (48 seconds)
Published: Wed Sep 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.