例:
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;
MyProperty []だけを含むオブジェクトの代わりに、リフレクションを使用して(またはBindingSourceから継承して)、MyClass.MyPropertyインスタンスへの参照を取得する方法はありますか。
BindingSource.DataSourceは、MyProperty配列にキャストできるオブジェクトを返します。
生成された結果は、次のシナリオを達成する必要があります。
BindingSource.DataSource = GeneratedResult; //execute some code (from the get).