zoukankan      html  css  js  c++  java
  • 反射

    static void  CheckBasePage()
            {
                Assembly assembly = Assembly.GetAssembly(typeof(BasePage));    
              
                Module module = assembly.ManifestModule;
                Type[] types = module.GetTypes();          
                foreach (Type t in types)
                {
                    try
                    {
                        if (t.IsSubclassOf(typeof(System.Web.UI.Page)))
                        {
                            if (!t.IsSubclassOf(typeof(BasePage)))
                            {
                                string aa = t.ToString() + "没有继承该类";
                                Console.WriteLine(aa);                           
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message + "-" + ex.StackTrace);
                    }

                }

                //Assembly a = Assembly.LoadFile(@" ");
                //Type[] type = a.GetTypes();
                //foreach (Type t in type)
                //{
                  
                //    try
                //    {
                      
                //        if (t.IsSubclassOf(typeof(System.Web.UI.Page)))
                //        {
                //            BasePage o = (BasePage)a.CreateInstance(t.FullName);
                //            object value = t.GetProperty("Guid").GetValue(o, null);
                //        }
                //    }
                //    catch
                //    { }
                //}
            }

  • 相关阅读:
    Ubuntu16.04+cuda9.0+matlab+opencv3.3+caffe服务器配置(问题汇总)
    numpy 实践记录
    qwe框架- CNN 实现
    qwe 简易深度框架
    深度拾遗(08)
    python 环境配置
    Robotframework Web自动化实战课程
    常用javascript代码片段集锦
    AJax跨域请求百度音乐接口数据展示页面
    JavaScript 经典实例收集整理
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1004638.html
Copyright © 2011-2022 走看看