Runtime creation of generic Func

后端 未结 4 823
野趣味
野趣味 2020-12-29 07:32

I need to implement the method:

object GetFactory(Type type);

This method needs to return a Func where typeparam \'T\' is the \

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 08:22

    I think the usual approach would be to make the "dumb" version be the thing that you spoof at runtme, and then provide a helper extension method to provide the type-safe version on top of it.

提交回复
热议问题