c#反射应用
static void TestReflect() { DirectoryInfo dir = new DirectoryInfo("dll"); FileInfo[] fiArr=dir.GetFiles(); for (int i = 0; i < fiArr.Length; i++) { FileInfo info=fiArr[i]; Assembly asm = Assembly.LoadFrom(info.FullName); String className = info.Name.Replace(".dll", "") + ".IPCrawler"; IProxyIP.IIP iip = (IProxyIP.IIP)asm.CreateInstance(className); List<ProxyIP> list= iip.GetIPList(); foreach (var item in list) { Console.WriteLine(item); } } Console.WriteLine(); }