C# 有委托，而且有 Func<> 和 Action<>，可以说函数被视为一等功名，跟 int、bool 等类型并没有什么区别。那么很多事情就简单了。

f(x)，它们接收参数，得到结果，并且相同的参数得到的结果一定是相同的，用映射来说，它是满射的。另外这个函数不会改变任何的状态值，它是无副作用的。

var function = new Func<int, int, int> ((x, y) => x + y); function(1, 2); //
returns 3

function 1 2

function(1)(2);

Func<int, Func<int, int>> Currying(Func<int, int, int> f) => x => y => f(x, y);

public static class CurryingExtensions { public static Func<int, Func<int, int
>> Currying(this Func<int, int, int> f) => x => y => f(x, y); }

var function = new Func<int, int, int> ((x, y) => x + y) .Currying(); function(
1)(2); // returns 3

public static class CurryingExtensions { public static Func<T1, Func<T2,
TOutput>> Currying<T1, T2, TOutput>(this Func<T1, T2, TOuput> f) => x => y =>
f(x, y); }

Unit

var happyWater = new Func<float, int, float> ((float price, int number) =>
number * price) .Currying(); // 调用：happyWater(快乐水单价)(快乐水件数); var cocaHappyWater
= happyWater(3.5f); var pepsiHappyWater = happyWater(3); var mcdHappyWater =
happyWater(9);

var calcPrice = new Func<Func<int, float>, float, int, float> ((calc,
discount, number)=> discount * calc(number)) .Currying(); //

var pepsiPriceCalc = calcPrice(pepsiHappyWater); var cocaPriceCalc =
calcPrice(cocaHappyWater);var priceCalcA = pepsiPriceCalc(1); // A 超市 var
priceCalcB = cocaPriceCalc(0.8f); // B 超市

var priceA = priceCalcA(3); var priceB = priceCalcB(5); var total = priceA +
priceB;

using System; namespace ColaMarket { static class CurryingExtensions { public
static Func<T1, Func<T2, TOutput>> Currying<T1, T2, TOutput>(this Func<T1, T2,
TOutput> f) => x => y => f(x, y); public static Func<T1, Func<T2, Func<T3,
TOutput>>> Currying<T1, T2, T3, TOutput>(this Func<T1, T2, T3, TOutput> f) => x
=> y => z => f(x, y, z); } class Program { static void Main(string[] args) { var
happyWater =new Func<float, int, float> ((float price, int number) => number *
price) .Currying();var cocaHappyWater = happyWater(3.5f); var pepsiHappyWater =
happyWater(3); var mcdHappyWater = happyWater(9); var calcPrice = new Func<Func<
int, float>, float, int, float> ((calc, discount, number) => discount *
calc(number)) .Currying();var pepsiPriceCalc = calcPrice(pepsiHappyWater); var
cocaPriceCalc = calcPrice(cocaHappyWater); var priceCalcA = pepsiPriceCalc(1);
var priceCalcB = cocaPriceCalc(0.8f); var priceA = priceCalcA(3); var priceB =
priceCalcB(5); var total = priceA + priceB; Console.WriteLine(total); } } }