1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
private void button2_Click(object sender, System.EventArgs e)
{
this.openFileDialog1.ShowDialog();
string path = this.openFileDialog1.FileName;
MethodInfo[] mi = null;
object result = null ;
Assembly a = Assembly.LoadFrom(path);
Type[] types = a.GetTypes();
foreach (Type CurrentType in types)
{
mi = CurrentType.GetMethods();
string typeName = CurrentType.FullName;
this.listBox1.Items.Add(typeName);
object lateBoundObject = a.CreateInstance(typeName);
CurrentType.InvokeMember("ForMdll",BindingFlags.InvokeMethod |
BindingFlags.Public |
BindingFlags.Static,null,lateBoundObject,null);
break;
}
} |
Partager