VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > temp > C#教程 >
  • C#反射运行该类下的方法

Text:反射的类名

s:方法名

data:参数

 

如果无参则:

(string)method.Invoke(obj, null);

 

Type type = typeof(Text);
MethodInfo method = type.GetMethod("s");
ceshi data =new ceshi();
object[] parameters = new object[] {data};
object obj = Activator.CreateInstance(type);
string result = (string)method.Invoke(obj, parameters);

 


相关教程