Created
May 5, 2018 21:43
-
-
Save christiannagel/4a3c9cebfa05d27ad3e2e43243020dd4 to your computer and use it in GitHub Desktop.
Local functions with C# 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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