Skip to content

Instantly share code, notes, and snippets.

@aemloviji
Created May 5, 2020 06:22
Show Gist options
  • Save aemloviji/4512e8accc1c31548d56c3d4c968e018 to your computer and use it in GitHub Desktop.
Save aemloviji/4512e8accc1c31548d56c3d4c968e018 to your computer and use it in GitHub Desktop.
Higher-order function in C#
public static void Main(string[] args)
{
Func<int, int> doubleCall(Func<int, int> func) => x => func(func(x));
static int plusN(int n) => n + 3;
Console.WriteLine(doubleCall(plusN)(5));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment