Access properties from a class not belonging to the namespace
-
Hello, I have a class without a namespace. The main reason why I don't have a namespace in that class is because I use that class in all my applications. Now I like to update application settings in that class, but I don't like to use the following line in that class: using ApplicationNamespace.Properties; Is there a way where i can reference that up to my class?
-
Hello, I have a class without a namespace. The main reason why I don't have a namespace in that class is because I use that class in all my applications. Now I like to update application settings in that class, but I don't like to use the following line in that class: using ApplicationNamespace.Properties; Is there a way where i can reference that up to my class?
You may think that your class is not contained in a namespace, but it IS in one. The default name for a namespace is the name of the project.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
You may think that your class is not contained in a namespace, but it IS in one. The default name for a namespace is the name of the project.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Well, that's the point, i would like to be able to copy the class everywhere without changing/adding the projects namespace into the class and still updating the namespace's settings. Maybe it is impossible, but i like to ask.
Yeah, it is, you can't change the namespace your code is in.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Well, that's the point, i would like to be able to copy the class everywhere without changing/adding the projects namespace into the class and still updating the namespace's settings. Maybe it is impossible, but i like to ask.
Like Christian said, you can't do that. The namespace is part of the fully qualified name of the class. Changing it is out of the question. The only way you can use this class in other projects is to add a reference to it's .DLL. Importing the namespace is optional, but it saves you from having to type the full namespace/class path in your other project's code.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007