Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active November 1, 2017 04:40
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 Ibro/f2ab889981f11c90dc14f767ee8d7bdd to your computer and use it in GitHub Desktop.
Save Ibro/f2ab889981f11c90dc14f767ee8d7bdd 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 = Sum(a, b);
int difference = Difference(a, b);
return sum * difference;
int Sum(int x, int y)
{
return x + y;
}
int Difference(int x, int y)
{
return x - y;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment