Why can you not use anon function with a dynamic parameter?

后端 未结 2 405
自闭症患者
自闭症患者 2021-02-05 11:15

Just ran into this today

An anonymous function or method group cannot be used as a constituent value of a dynamically bound operation.

2条回答
  •  佛祖请我去吃肉
    2021-02-05 11:45

    I meant that you need to cast the lambda method to the expect expression you want. Then it'll work just fine.

    Like this:

    return ifNotNull(firstAddress, (Func)((a) => a.address_1), null);
    

提交回复
热议问题