[Request] When creating a C# file, use file-scoped namespace declaration if possible
See original GitHub issueIn C# 10 we can now use a new form of the namespace declaration to declare that all subsequent declarations are members of the declared namespace:
namespace MyNamespace;
Is this extension able to detect the version of C# being used and use this new syntax?
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
c# - How can I use a file-scoped namespace declaration in ...
You have to set up your project's editorconfig to prefer File-scoped namespaces. Right click your project. Select "Add" → "New Item".
Read more >File scoped namespaces - C# feature specifications
This feature specification describes file scoped namespaces, where the entire contents of a file are included in a namespace declared at the ...
Read more >File-Scoped Namespace Declaration in C#
In this article, we will learn about File-Scoped Namespace Declaration in C#. Introduction. Maintaining clean and organized code is crucial ...
Read more >Using File-Scoped Namespaces in .NET 6 | by Jamie Burns
The main limitation we have when using file-scoped namespace is that a file can only contain a single namespace declaration. This makes sense, ......
Read more >How to set C# 10+ file scoped namespaces as default in ...
Tried this and I still get an error that my 'file scoped namespace' is not available in C# 7.3. Please use language version...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
up
Update
After i read this extension source code, i’ve noticed that we can modify templates just:
%USERPROFILE%\.vs\.templates
Templates
folder in this repository.Example:
Content of
.cs.txt
that extension will read:Same also for
.cs-interface.txt
I feel like this feature should have been documented somewhere on the readme. I’ve been using this extension for quite some time, and this would have come in handy more than once.