Assembly assem = AppDomain.CurrentDomain.Load("DllOutput");
Type t = assem.GetType("DllOutput.DllOutput");
object objInstance = System.Activator.CreateInstance(t);
MethodInfo[] methods = t.GetMethods();
foreach(MethodInfo method in methods)
{
this.listBox1.Items.Add(method.Name);
}感觉用反射作不难(难道我理解错了?),举个小例子DllOutput.dll在本机的debug的bin目录下
Type t = assem.GetType("DllOutput.DllOutput");
object objInstance = System.Activator.CreateInstance(t);
MethodInfo[] methods = t.GetMethods();
foreach(MethodInfo method in methods)
{
this.listBox1.Items.Add(method.Name);
}感觉用反射作不难(难道我理解错了?),举个小例子DllOutput.dll在本机的debug的bin目录下
是namespace + classname
但在C#中可以实现这种功能,用datatable举个例子
DataTable dtTable = new DataTable();
Type t = dtTable.GetType();
MethodInfo[] methods = t.GetMethods();//得到dtTable所有的方法
foreach(MethodInfo method in methods)
{
this.listBox1.Items.Add(method.Name);//显示方法名
}
然后具体怎么用"."把方法名显示出来。俺就不清楚了(运算符的重载?)
-________________-b
多少明白了一点
揭帖了