Assembly _dll = Assembly.LoadFrom(Application.StartupPath.Trim() + "\\Student.dll");
System.Type t = _dll.GetType("Student.studentA");//命名空间.类名
object o = System.Activator.CreateInstance(t);//创建实例
System.Reflection.MethodInfo mi = t.GetMethod("Get_name");//获得方法
FieldInfo [] Fs=t.GetFields();
MessageBox.Show(mi.Invoke(o, new object[] {">>" }).ToString());//调用方法
时间: 2024-12-26 10:09:21