Update: Local functions where added in version 7 C#.
void OuterMethod()
{
int foo = 1;
InnerMethod();
void InnerMethod()
{
int bar = 2;
foo += bar
}
}
In previous version C# you have to use action like this:
void OuterMethod()
{
int anything = 1;
Action InnedMethod = () =>
{
int PlitschPlatsch = 2;
};
InnedMethod();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…