2

与えられたプロパティ:

Func<dynamic,object> Format { set; get; }

そしてメソッドパラメータ:

void SomeMethod(Func<T, object> format) { // Set Format here.. }

このメソッド内で、Format プロパティをどのように設定しますか?

4

1 に答える 1

3

create a new function that takes the dynamic object, casts it to the object that you need it to be, and then passes that value to the more specific function that you have:

Format = dyn => format((T)dyn);
于 2013-08-29T21:12:25.213 に答える