Reputation: 15866
What does this answer to another question mean?
Yes, creating a nested namespace is possible. However, I believe the preferred methodology for something like this would be to create a resource file
This gives you the added benefit of being able to change without a code change, as well as to support multiple languages.
I am making a few namespaces and I want them to be all under one namespace (MyNamespace
), but I don't feel like going and changing all the code to add nested interfaces, and naming them MyNamespace.N1
is not very compatible with intelli-sense.
Edit: My main problem is that namespace MyNamespace.N1 { }
does not seem to work right with renames and stuff like that. Is it even a true nested namespace declaration?
Underlying Question: A namespace declaration with a period in it is two namespaces. Why, then, when I rename it, does it not act right with the rename. My question may be vague, but I have such a problem with it that I thought for sure a lot of other people would have run into it. If not, then just close it and I'll try to figure it out some other way.
I'm trying to figure out how to put all the namespaces in a project under one namespace. So you would access them using MyProject.MyN1.MyClass
. If I declare the namespace like namespace MyProject.MyN1 { }
and then try to rename it, the intelli-sense only looks at "MyProject" as the namespace, MyN1 is peripheral. But I'm really trying to rename "MyN1" and it doesn't like doing that.
Well, I tried that, and now I'm not sure what my problem was in the first place. As I described it it works fine. I think it was that if I try to add or remove a period in the namespace declaration it doesn't rename it right.
Upvotes: 1
Views: 786
Reputation: 15866
One way that would probably work is to using a global find and replace. What your actually trying to do is to rename two namespaces into one, and it's not going to let you.
Upvotes: 1