Skip to content

Instantly share code, notes, and snippets.

@namelos
Created May 25, 2016 14:30
Show Gist options
  • Save namelos/4a00360279547277aa2127acaaa70974 to your computer and use it in GitHub Desktop.
Save namelos/4a00360279547277aa2127acaaa70974 to your computer and use it in GitHub Desktop.
class Program
{
static void Main(string[] args)
{
Func<int, Func<int, Func<int, int>>> add = x => y => z => x + y + z;
WriteLine(add(1)(2)(3));
Func<Func<int>> Closure = () =>
{
int property = 1;
return () =>
{
WriteLine(property);
return property = property + 1;
};
};
var closure = Closure();
closure();
closure();
closure();
ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment