[Draft proposal] : auto namespace (Define namespace depending on location file) #7908
Unanswered
ToovR
asked this question in
Language Ideas
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
IMO, any competent IDE should offer to update namespaces for you, either on file move or with a warning on the namespace. Rider, for example, does. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
auto namespace
Summary
auto namespace is a feature which avoids writing namespace name and evaluates namespace name based on project namespace and file location.
Motivation
When you need to move a C# file in your project or from a project to another, you need to change your namespace name definition to fit the new project, new folder location.
With auto namespace, you do not need to care about naming the namespace. It would be automatically defined on project building depending the namespace of the project and the file location.
Auto namespace could also avoid Typos when manually declare a namespace.
For example, let's imagine a C# class library project "Some.Namespace.MyLibraryClass" with a class file stored in the project as "./Folder/Stored/".
We should have by default one of the following namespace declarations :
by replacing with a specific key word, to be defined but here written as "auto namespace", we could write as follows and simplify moving files, and avoid typos:
Beta Was this translation helpful? Give feedback.
All reactions