using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace Dachie { class Program { static void Main(string[] args) { Assembly a = Assembly.LoadFrom(@"DLL文件绝对路径"); Type[] mytypes = a.GetTypes(); BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (Type t in mytypes) { MethodInfo[] mi = t.GetMethods(flags); Object obj = Activator.CreateInstance(t); foreach (MethodInfo m in mi) { m.Invoke(obj, null); } } } } }
作者:达奇
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。