C# Functional style - Part 3
07/28/2018
In this post I will take the existing methods to a higher abstraction by handling them as pure C# Func.
First we need to introduce a couple of extension methods, which will help to Curry and Partially apply some of the arguments on the existing methods. In C# this is a slightly more difficult, because we would need to create overrides for each different signature based on the arity of the method.
Creating an extension method for Currying:
public static Func<TIn, Func<TOut>> C<TIn, TOut>(this Func<TIn, TOut> f) => x => () => f(x); public static Func<TIn1, Func<TIn2, TOut>> C<TIn1, TIn2, TOut>(this Func<TIn1, TIn2, TOut> f) => x => y => f(x, y); // Further overloads