您当前的位置: 首页 > 

染指流年灬

暂无认证

  • 3浏览

    0关注

    194博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

GetType因为命名空间问题导致返回空的解决方案

染指流年灬 发布时间:2022-07-19 14:37:36 ,浏览量:3

GetType默认是取Global空间的Type,如果要取特定空间的Type,就要输入参数“xxxSpace.xxxType"。

如果我们要一个可以搜索全部命名空间的GetType,可以这样写

            List GetTypes(string className)
            {
                List res = new List();
 
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                   var assemblyTypes = assembly.GetTypes();
                    for (int i = 0; i             
关注
打赏
1665909078
查看更多评论
0.0382s