我对 GetProperty 有疑问
partial class MyForm : Form
{
...
public System.Windows.Forms.BindingSource authorBindingSource = new ...;
public MethodicalWorkDataSetTableAdapters.authorTableAdapter authorTableAdapter = new ...;
...
public static object GetPropValue(object src, string propName)
{
return src.GetType().GetProperty(propName).GetValue(src, null);
}
public void someFunction()
{
GetPropValue( this, "authorBindingSource" ); // returns null
}
}
请帮助我,函数 GetPropValue 工作正常,除了“authorTableAdapter”和“authorBindingSource”