I want to get current namespace in a variable. I have the following piece of code.
Assembly assembly = Assembly.GetExecutingAssembly();
foreach(Type type in assembly.GetTypes())
{
Console.WriteLine(type.Namespace);
}
By executing it, it show me the following:
System.Type[]
mynamespace
mynamespace
mynamespace
mynamespace
mynamespace.Properties
mynamespace
....
I also have this piece of code that return me the current namespace in string.
string name = MethodInfo.GetCurrentMethod().ReflectedType.Namespace;
What I want to do is to get the namespace, pass it to a variable. so the variable can use that namespace as reference to access the namespace methods and variables. basically I want to do something like this. I am looking for something like this:
this.GetCurrentNameSpace().variable1.ToString();
sounds funny but thats the kind of method/code I am looking for
How can I do it?