示例:
public class MyProperty
{
//something..
}
public class MyClass
{
private MyProperty[] myProperty = null;
public MyProperty[] myProperty
{
get
{
//execute some code
return myProperty;
}
set
{
myProperty = value;
}
}
}
MyClass testMyClass = new MyClass();
myBindingSource.DataSource = testMyClass.MyProperty;
有没有办法,可能使用反射(或继承自BindingSource)来获取对MyClass.MyProperty实例的引用,而不是仅包含MyProperty []的对象。
BindingSource.DataSource只返回某些对象,可以转换为某些 MyProperty数组。
生成的结果应该达到这种情况:
BindingSource.DataSource = GeneratedResult; //execute some code (from the get).