求助C#反射的知识
各位给我指导下c#中反射的知识啊,说简单点,加上例子就最好了,我基础差……
程序代码: /// <summary>
/// 根据反射创建窗体
/// </summary>
/// <param name="f">窗体类名</param>
public void bindForm(string f)
{
System.Type t = System.Type.GetType(f);//得到类型
object ff = Activator.CreateInstance(t, null);//实例化
System.Reflection.MethodInfo method = t.GetMethod("Showdialog");//通过反射访问成员
object returnValue = method.Invoke(ff, null);
t.GetProperty("Parent").SetValue(ff, this.tabControl1.TabPages[0], null);//通过反射赋值
t.GetProperty("Dock").SetValue(ff, DockStyle.Fill, null);
}如果你知道类名是啥,你就可以通过反射实例化它,以及访问它的成员








