I’m working with WPF and often have the need to get the namespace and assembly name of a given class. But I don’t know how to do this.
So, how can we get the names when browsing the classes in the Solution Explorer or/and when editing the class’s codes? Please help!
You could use the Visual Studio Immediate Window as a quick way to obtain the assembly qualified name for one of the solution projects.
IIRC, these steps should work:
typeof(ClassNameOfStep1).AssemblyQualifiedNameand press Enter.The Immediate Window depends on Design-Time Expression Evaluation
which in turns depends of Visual Studio Hosting Process so you need to have it enabled, which by default already is.
Also, I did some quick tests and the Name of the class was sufficient in all cases except when I tried it on VS 2008, which required me to provide the
FullNameof the type. So ifNameresults in error use theNamequalified with the namespace.