Joan Venge Joan Venge - 1 year ago 106
C# Question

Does C# support function composition?

In the latest version of C#, can I do something like this?

I feel like linq is the closest but that's chaining, not function composition, right?

Answer Source

I did not let the compiler check this, but this should be possible:

Func<T3,T1> my_chain(Func<T2,T1> f1, Func<T3,T2> f2)
    return (x=> f2(f1(x)));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download