Mega Code Archive
Categories
/
C# Tutorial
/
LINQ
Add extension to Func
using System; using System.Collections.Generic; using System.Linq; using System.Text; static class CurryingExtensions { public static Func
> myExt
(this Func
f) { return a => b => f(a, b); } } class MainClass { static void Main() { Func
adder = (x, y) => (x + y); Func
> c = adder.myExt(); Func
addsTwo = c(2); Console.WriteLine(addsTwo(5)); } }