Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
与えられたプロパティ:
Func<dynamic,object> Format { set; get; }
そしてメソッドパラメータ:
void SomeMethod(Func<T, object> format) { // Set Format here.. }
このメソッド内で、Format プロパティをどのように設定しますか?
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);