Skip to content

Instantly share code, notes, and snippets.

@Mozart-Alkhateeb
Created January 23, 2020 13:11
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 Mozart-Alkhateeb/cc53b39db28e9ed10d498e4fc5bdfc45 to your computer and use it in GitHub Desktop.
Save Mozart-Alkhateeb/cc53b39db28e9ed10d498e4fc5bdfc45 to your computer and use it in GitHub Desktop.
Local Functions Example C#
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
//This function has access Only to its direct children [MakeTextUpperCase, GetName]
Console.WriteLine(GetName());
string MakeTextUpperCase(string x)
{
return x.ToUpper();
}
string GetName()
{
return MakeTextUpperCase($"{GetFirstName()} {GetLastName()}");
string GetFirstName()
{
return "Mozart";
}
string GetLastName()
{
return "Al Khateeb";
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment