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

前端 未结 16 1359
旧巷少年郎
旧巷少年郎 2020-11-22 02:58

This code:

Type.GetType(\"namespace.a.b.ClassName\")

returns null.

and I have in the usings:

using nam         


        
16条回答
  •  花落未央
    2020-11-22 03:37

    Type.GetType("namespace.qualified.TypeName") only works when the type is found in either mscorlib.dll or the currently executing assembly.

    If neither of those things are true, you'll need an assembly-qualified name:

    Type.GetType("namespace.qualified.TypeName, Assembly.Name")
    

提交回复
热议问题