Skip to content

Instantly share code, notes, and snippets.

@Ibro
Created November 1, 2017 04:42
Show Gist options
  • Save Ibro/87e076f15890820b420692f8e9cac4e6 to your computer and use it in GitHub Desktop.
Save Ibro/87e076f15890820b420692f8e9cac4e6 to your computer and use it in GitHub Desktop.
Local Functions in C# 7
public class LocalFunctions
{
public int SomeProduct(int a, int b)
{
int Sum(int x, int y)
{
return x + y;
}
int Difference(int x, int y)
{
return x - y;
}
int sum = Sum(a, b);
int difference = Difference(a, b);
return sum * difference;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment