Can you chain the result of one delegate to be the input of another in C#?

前端 未结 5 1068
春和景丽
春和景丽 2021-01-14 13:09

I am looking for a way to chain several delegates so the result from one becomes the input of the next. I am trying to use this in equation solving program where portions ar

5条回答
  •  星月不相逢
    2021-01-14 14:07

    Yes this is possible - you need to ensure that the return type of the delegate is one that is the parameter type of the delegate being invoked.

    A lot of LINQ is built this ways, though you may want to take a look at expressions.

提交回复
热议问题