GooglePrettify

2017年4月27日 星期四

Type.GetType(“namespace.a.b.ClassName”) returns null

You can also get the type without assembly qualified name but with the dll name also, for example:
Type myClassType = Type.GetType("TypeName,DllName");
I had the same situation and it worked for me. I needed an object of type "DataModel.QueueObject" and had a reference to "DataModel" so I got the type as follows:
Type type = Type.GetType("DataModel.QueueObject,DataModel");
The second string after the comma is the reference name (dll name).

from : http://stackoverflow.com/questions/1825147/type-gettypenamespace-a-b-classname-returns-null

沒有留言:

張貼留言