Exemplo n.º 1
0
        /// <summary>
        /// 获得所有程序集中符合特定标签的类
        /// </summary>
        /// <returns>找到的类</returns>
        private List <Type> GetAllTypes()
        {
            List <Type>     lstReutrnValue = new List <Type>();
            List <Assembly> lstAllAssembly = new List <Assembly>();

            //获得所有程序集
            lstAllAssembly = AssemblyUtility.GetAllAssembly();
            //获得程序集内所有的类型
            foreach (var tempAssembly in lstAllAssembly)
            {
                //防止反射异常
                try
                {
                    //获得所有被标签定义的类
                    foreach (var oneType in tempAssembly.GetTypes())
                    {
                        if (null != oneType && typeof(ITransformerTag).IsAssignableFrom(oneType))
                        {
                            lstReutrnValue.Add(oneType);
                        }
                    }
                }
                catch (Exception)
                {
                    ;
                }
            }
            return(lstReutrnValue);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 静态构造,加载程序集
 /// </summary>
 static UseBinder()
 {
     //静态加载所有程序集
     m_lstAllAssembly = AssemblyUtility.GetAllAssembly();
 }