-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (49 loc) · 1.04 KB
/
Program.cs
File metadata and controls
54 lines (49 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//CIL Tools Example - programmatically disassemble method and display CIL code
using System;
using CilTools.BytecodeAnalysis.Extensions;
namespace ExampleDisassemble
{
class Program
{
public static void Foo()
{
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
}
static void Main(string[] args)
{
Console.WriteLine(typeof(Program).GetMethod("Foo").GetCilText());
Console.ReadKey();
}
}
}
/* Output:
.method public hidebysig static void Foo() cil managed
{
.maxstack 2
.locals (int32 V_0,
bool V_1)
nop
ldc.i4.0
stloc.0
br.s IL_0002
IL_0001: nop
ldloc.0
call void [mscorlib]System.Console::WriteLine(int32)
nop
nop
ldloc.0
ldc.i4.1
add
stloc.0
IL_0002: ldloc.0
ldc.i4.s 10
clt
stloc.1
ldloc.1
brtrue.s IL_0001
ret
}
*/