插件设计
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace ConsoleApplication1 { class Program { private static string _vsPath = @"D:\work\0411\test\Solution2\WindowsFormsApplicationTest\bin\Debug\WindowsFormsApplicationTest.exe"; static void Main(string[] args) { System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(_vsPath); List<System.Type> lstType = new List<Type>(); System.Type[] types = assembly.GetTypes(); lstType.AddRange(types); foreach (Type type in lstType) { if (type.FullName == "WindowsFormsApplicationTest.Form1") { object obj = Activator.CreateInstance(type); Application.EnableVisualStyles(); Application.Run((System.Windows.Forms.Form)obj); break; } } Console.WriteLine("Over"); Console.Read(); } } }