CSharp examples for Custom Type:Local Method
Create Local Method
using System;//ww w . jav a 2 s.c o m using System.ComponentModel; using System.Runtime.CompilerServices; class LocalMethodIntro { static void Main() { int x = 10; PrintAndIncrementX(); PrintAndIncrementX(); Console.WriteLine($"After calls, x = {x}"); void PrintAndIncrementX() { Console.WriteLine($"x = {x}"); x++; } } }