把这个对象变量作为这个类的一个字段就可以: Type t = this.GetType(); FieldInfo fi = t.GetField("tt"); Test tt = (Test) fi.GetValue(this);
Test tt=new Test() Type t = typeof (Test); MethodInfo m = t.GetMethod("MethodName"); args = new object[2]; args[0] = 1; args[1] = 2; m.Invoke(tt,args); 如上!args是你方法的参数!
Type t = this.GetType();
FieldInfo fi = t.GetField("tt");
Test tt = (Test) fi.GetValue(this);
Type t = typeof (Test);
MethodInfo m = t.GetMethod("MethodName");
args = new object[2];
args[0] = 1;
args[1] = 2;
m.Invoke(tt,args);
如上!args是你方法的参数!
Button tt=new Button();
tt.ID="ccc";
tt.Text="dd";
Panel1.Controls.Add(tt);
……
((Button)this.FindControl("ccc")).Text="ccdddd";
……
在运行的时候动态的获得对某个对象的引用,不知道是否可以实现,还望各位高手指点
Test tt=new Test()
Console.Write(tt.value1)
//那么这里用何种方式来获得呢?有没有什么FindObject之类的?
//((Test )this.FindObject("tt")).Value="ccdddd";