プライベートメソッドを使用できるように以下のコードを変更したい
//use reflection to Load the data
var method =
typeof(MemberDataFactory)
.GetMethod("LoadData")
.MakeGenericMethod(new [] { data.GetType() })
.Invoke(this, null);
私は運が悪かったので次のことを試みました:
//use reflection to Load the data
var method =
typeof(MemberDataFactory)
.GetMethod("LoadData")
.MakeGenericMethod(new [] { data.GetType() })
.Invoke(this, BindingFlags.Instance | BindingFlags.NonPublic, null , null, null);
また、このコードの観点から「var」とは何ですか?varを使用する代わりに、そのタイプを指定することをお勧めします。
ありがとう!