Reputation: 837
I have a Namespace called "Core", which is the main namespace of my project .
Then I've created new sub namespace named "Interface" that will contain all GUI and WPF classes of the library . There are many UserControl
s and Window
s ETC .
Meanwhile i have another class named "Interface" which is a STATIC class that deals and managing the Interface namespace and it's features . This is designed to avoid the user\developer to manage the GUI of his software so that's why I've created this static class .
So now i have a little problem that when calling the static class Core.Interface the Compiler does not separating between the sub namespace and the static class because both have the same name exactly .
I don't want to change their names so please do not suggest any new names . I just don't know if better to move the Interface class inside the Interface namespace or just delete the sub namespace "Interface" and move everything to the main Namespace "Core" , But then it would be a mess and I want some strict order in my project .
So what do you suggest me to do ?
UPDATE : OK , So I am convinced from the suggestions . I will find new proper names for the sub namespaces in each case . And keep the static classes where they are in the main namespace to avoid the user defining using of the sub namespaces just to use the main static class of each one of them .
Anyway thank you guys for answering and giving suggestions .
Upvotes: 1
Views: 145
Reputation: 4693
Rename name space Interface
to Interfaces
; since a name space usually contains multiple classes, a suffix of s
doesn't break semantics, might be even better.
Upvotes: 2
Reputation: 1237
Ideally, you should have clear difference between namespace and class. Namespaces are packages and class are thats goes in that package. for example you have a basket that contains apples and oranges, you wouldn't want to call the basket apples, do you.
If you really have to keep those names, then do not reference the namespace at the beginning with "using Core.Interface" instead call the full class path every time you use them, this way the compiler know which one you are using.
Another options is to use an alias like using InterfaceNameSpace = Core.Interface;
and use the InterfaceNameSpace definition when ever you want to use the sub class class and use the full path for the static class.
Upvotes: 2