[RESOLVED] Reference Default Namespace in Class
Hi and thanks for reading.
I'm trying to develop a generic class that uses Imports statements. Right now, the Imports reference the name of a specific project (e.g. "Imports WWRIS.DataAccessLayer" and "Imports WWRIS.Global"), I want to eliminate the "WWRIS" part to make the class truly generic (e.g. "Imports [Project Default Namespace].DataAccessLayer"). Is this possible?
I know I could remove the namespace for a project altogether, but I would prefer not too.
Thanks,
OneSource
Re: Reference Default Namespace in Class
You mean dynamically change the namesapce? Why would the name change? Isn't the project you are referencing going to have the same namespace?
Instead of importing the namespaces just call all the members by the full namespace (i.e. WWRIS.DataAccessLayer.MyMethod)
Re: Reference Default Namespace in Class
I can't give you a 100% iron-clad guarantee but I'm going to say with relative surety that it is not possible, and why would it be? If you were allowed to change the namespace like that then there would be no guarantee that each would contain the same members. If you want to use that library like that then you need to set it up in such a way that it will expect certain types that all the other projects can supply. This sounds like a job for an Interface to me. That way, the generic library can take and return objects that implement certain interfaces and your other projects can implement those interfaces, allowing them all to use the other library.