One of the changes to .Net, which cam in with .Net 6 I think, is the use of file scoped namespaces to reduce nesting.
I have created a solution containing .Net 8 project.
When I create a class using visual studio the default is to still nest the class within the namespace rather than use file scoped namespaces.
I expected it to default to file scoped namespaces as it was a .Net 8 project.
Is there a setting somewhere I need to alter?
Thanks for this.
You are right. I now realise I should have asked about "file scoped namespaces".
For clarification I found the full path to the option to be
Tools > Options> Text Editor > C# > Code Style > Code Block Preferences > Namespace Declarations = 'File scoped'.
I also found another solution at www.meziantou.net which was as follows
[*.cs]
csharp_style_namespace_declarations=file_scoped:suggestion
Which option should we go for
Any other considerations?
What you ask is file scoped namespaces, not top-level statements.
To use file scoped namespaces by default, go to Options, Code Style. In the Code Block Preferences block change Block Scoped to File Scoped. 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With