I am reading the book Functional Programming in C# by Enrico Buonanno (great book).
There is one example for swapping the order of arguments, namely:
static Func<T2, T1, R>
SwapArgs<T1, T2, R>(this Func<T1, T2, R> f) => (t2, t1) => f(t1, t2);
Can someone please explain why is the =>
used twice? For example, a function for diving would be written as
Func<int, int, int> divide = (x,y) => x / y;
The order is: function name followed by =
followed by arguments followed by =>
followed by the function body.
That is what is confusing me, in the SwapArgs
we don't have =
we have twice =>
.
Could someone please clarify this?