Problem Statement:
There is a DLL called CommonAssembly. This contains a namespace called CommonNamespace. This namespace contains a class called CommonClass.
Another project adds a reference to CommonAssembly and wants to get the type of CommonClass using the method Type.GetType.
Additional Information:
// This statement won’t work.
Type.GetType(“CommonClass”);
// This will not work either
Type.GetType(“CommonNamespace.CommonClass”);
Since CommonClass type is defined in a referred assembly, Type.GetType will not be able to get the required type.
Solution:
Type.GetType(“CommonNamespace.CommonClass, CommonAssembly”);
Anything that is given after the comma (“,”) is taken as the assembly name. This assembly is searched for the given type name.
If the required class is not encapsulated in any namespace, then omit the namespace name.
Type.GetType(“CommonClass, CommonAssembly”);
If this doesn’t work, then try giving the fully qualified name of the assembly.

September 11, 2007 at 9:39 am
You just saved my day!
September 11, 2007 at 9:58 am
It doesnt work..
September 11, 2007 at 10:02 am
Make sure you have given the correct qualified name. It should work.
November 1, 2007 at 7:30 pm
Type.GetType(”CommonClass”, CommonAssembly);
should be
Type.GetType(”CommonClass, CommonAssembly”);
It’s right in the explaination….
“Anything that is given after the comma (”,”) is taken as the assembly name.”
Just not the example….
November 4, 2007 at 3:11 pm
Oops, thanks for pointing it out, EzElmo.
December 14, 2007 at 10:07 pm
You can use:
myObject.GetType().AssemblyQualifiedName
to get the right string name to put in to Type.GetType()
June 3, 2008 at 7:17 am
Parabéns pelo Post!
Salvou minha noite…
Obrigado!
November 19, 2008 at 12:57 pm
Thanks.
I Saved my Job.
I Love You.
August 17, 2009 at 11:30 pm
Thanks you very much!
you saved my life… I love U