测试代码
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpStudy
{
class Program
{
static void Main(string[] args)
{
int i = 0;
Action action1 = () =>
{
System.Console.WriteLine(i);
};
i++;
Action action2 = () =>
{
System.Console.WriteLine(i);
};
i++;
action1();
action2();
}
}
}
代码如下:
private static void Main(string[] args)
{
<>c__DisplayClass2 CS$<>8__locals3 = new <>c__DisplayClass2();
CS$<>8__locals3.i = 0;
Action action1 = new Action(CS$<>8__locals3.<Main>b__0);
CS$<>8__locals3.i++;
Action action2 = new Action(CS$<>8__locals3.<Main>b__1);
CS$<>8__locals3.i++;
action1();
action2();
}
代码如下:
public void <Main>b__0()
{
Console.WriteLine(this.i);
}
public void <Main>b__1()
{
Console.WriteLine(this.i);
}