局部函数就是函数中套函数
例如:
static void Main(string[] args)
{
int Result = Add(5, 7) + subtract(6,2);
Console.WriteLine("结果:"+Result);
Console.ReadKey();
//加
int Add(int a,int b) {
return a + b;
}
//减
int subtract(int a,int b) {
return a - b;
}
}
局部函数的位置可以在主函数中的任意位置,并且可以无限嵌套