Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created May 5, 2018 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/4a3c9cebfa05d27ad3e2e43243020dd4 to your computer and use it in GitHub Desktop.
Save christiannagel/4a3c9cebfa05d27ad3e2e43243020dd4 to your computer and use it in GitHub Desktop.
Local functions with C# 7
// C# 6
public void SomeFunStuff()
{
Func<int, int, int> add = (x, y) => x + y;
int result = add(38, 4);
Console.WriteLine(result);
}
// C# 7
public void SomeFunStuff()
{
int add(int x, int y) => x + y;
int result = add(38, 4);
Console.WriteLine(result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment