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

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

    For me, a "+" was the key! This is my class(it is a nested one) :

    namespace PortalServices
    {
    public class PortalManagement : WebService
    {
        public class Merchant
        {}
    }
    }
    

    and this line of code worked:

    Type type = Type.GetType("PortalServices.PortalManagement+Merchant");
    

提交回复
热议问题