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

前端 未结 16 1553
旧巷少年郎
旧巷少年郎 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:31

    If the assembly is referenced and the Class visible :

    typeof(namespace.a.b.ClassName)
    

    GetType returns null because the type is not found, with typeof, the compiler may help you to find out the error.

提交回复
热议问题