Open RihanArfan opened 1 year ago
Thanks for the suggestion! A first step here would be to review the FileCodeModel and see how it affects members, and if it is registered the same way or differently than the regular namespace approach.
This should be easy to implement. Check whether there is only one namespace in the file. If so, then automatically Use file scoped namespaces, otherwise give up.
In VS2022, when the file is opened, if you add a semicolon to the end of the namespace line, VS will automatically handle it (delete its brace pair);
It would be nice if CodeMaid supported formatting to file scoped namespaces.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces
This is supported in C# 10, and .NET 6+.