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
                //    { }
                //}
            }

  • 相关阅读:
    HiDPI的社区Wiki与部分解决方案
    Linux 桌面玩家指南:在 Ubuntu 中使用 deepin-wine,解决一些依赖 Windows 的痛点问题
    如何安装 Whisker Menu菜单
    为什么用 embed 方式插入的 Flash 元素总能把其它元素盖住?修改 z-index 属性也没用。
    Python 所谓的艺术操作
    Python 画矩形
    Python pygame中的颜色
    Python 创建一个Pycharm窗口
    Python画一个圆
    汉诺塔
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1004638.html
Copyright © 2011-2022 走看看