// Clipcode Snippets for .NET Intermeidate Language (IL) // // The following code snippets shows how to use various // language features of IL. //============================================================== .assembly extern mscorlib { .publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // |.....y. .ver 2:0:5:0 } .assembly Clipcode.Snippets.IL { } .module Clipcode.Snippets.IL.dll // MVID: {04A6843C-CF12-47B2-AB6E-72E1F0627D69} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY // Image base: 0x0000000000280000 // =============== CLASS MEMBERS DECLARATION =================== .class private auto ansi ObjectDemos extends [mscorlib]System.Object { .class auto ansi nested public beforefieldinit BaseCallvirt extends [mscorlib]System.Object { .method public hidebysig instance void Run() cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method BaseCallvirt::Run .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method BaseCallvirt::.ctor } // end of class BaseCallvirt .class auto ansi nested public beforefieldinit DerivedCallvirt extends ObjectDemos/BaseCallvirt { .method public hidebysig instance void Run() cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method DerivedCallvirt::Run .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void ObjectDemos/BaseCallvirt::.ctor() IL_0006: ret } // end of method DerivedCallvirt::.ctor } // end of class DerivedCallvirt .class auto ansi nested public beforefieldinit CastclassDemoClass extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method CastclassDemoClass::.ctor } // end of class CastclassDemoClass .class sequential ansi sealed nested private beforefieldinit InitobjClass extends [mscorlib]System.ValueType { .pack 0 .size 1 } // end of class InitobjClass .class auto ansi nested private beforefieldinit InstClass extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method InstClass::.ctor } // end of class InstClass .class auto ansi nested private beforefieldinit LdfldClass extends [mscorlib]System.Object { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 16 (0x10) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldc.i4.s 45 IL_0003: stfld int32 ObjectDemos/LdfldClass::x IL_0008: ldarg.0 IL_0009: call instance void [mscorlib]System.Object::.ctor() IL_000e: nop IL_000f: ret } // end of method LdfldClass::.ctor } // end of class LdfldClass .class auto ansi nested private beforefieldinit ldsfldClass extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method ldsfldClass::.ctor .method private hidebysig specialname rtspecialname static void .cctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldc.i4.4 IL_0001: stsfld int32 ObjectDemos/ldsfldClass::x IL_0006: ret } // end of method ldsfldClass::.cctor } // end of class ldsfldClass .class auto ansi nested private beforefieldinit NewobjClass extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method NewobjClass::.ctor } // end of class NewobjClass .class auto ansi nested private beforefieldinit stfldClass extends [mscorlib]System.Object { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 16 (0x10) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldc.i4.s 45 IL_0003: stfld int32 ObjectDemos/stfldClass::x IL_0008: ldarg.0 IL_0009: call instance void [mscorlib]System.Object::.ctor() IL_000e: nop IL_000f: ret } // end of method stfldClass::.ctor } // end of class stfldClass .class auto ansi nested private beforefieldinit StsfldClass extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method StsfldClass::.ctor .method private hidebysig specialname rtspecialname static void .cctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldc.i4.4 IL_0001: stsfld int32 ObjectDemos/StsfldClass::x IL_0006: ret } // end of method StsfldClass::.cctor } // end of class StsfldClass .method private hidebysig specialname rtspecialname static void .cctor() cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method ObjectDemos::.cctor .method public hidebysig static void Run() cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method ObjectDemos::Run .method private hidebysig static void BoxDemo() cil managed { // Code size 16 (0x10) .maxstack 1 .locals init ([0] int32 x) IL_0000: nop IL_0001: ldc.i4.3 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: box [mscorlib]System.Int32 IL_0009: call void ObjectDemos::BoxMethod(object) IL_000e: nop IL_000f: ret } // end of method ObjectDemos::BoxDemo .method private hidebysig static void BoxMethod(object o) cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method ObjectDemos::BoxMethod .method private hidebysig static void CallvirtDemo() cil managed { // Code size 17 (0x11) .maxstack 1 .locals init ([0] class ObjectDemos/DerivedCallvirt x, [1] class ObjectDemos/BaseCallvirt y) IL_0000: nop IL_0001: newobj instance void ObjectDemos/DerivedCallvirt::.ctor() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: stloc.1 IL_0009: ldloc.1 IL_000a: callvirt instance void ObjectDemos/BaseCallvirt::Run() IL_000f: nop IL_0010: ret } // end of method ObjectDemos::CallvirtDemo .method private hidebysig static void CastclassDemo() cil managed { // Code size 15 (0xf) .maxstack 1 .locals init ([0] class ObjectDemos/CastclassDemoClass x) IL_0000: nop IL_0001: newobj instance void ObjectDemos/CastclassDemoClass::.ctor() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: call void ObjectDemos::CastclassMethod(object) IL_000d: nop IL_000e: ret } // end of method ObjectDemos::CastclassDemo .method private hidebysig static void CastclassMethod(object o) cil managed { // Code size 9 (0x9) .maxstack 1 .locals init ([0] class ObjectDemos/CastclassDemoClass y) IL_0000: nop IL_0001: ldarg.0 IL_0002: castclass ObjectDemos/CastclassDemoClass IL_0007: stloc.0 IL_0008: ret } // end of method ObjectDemos::CastclassMethod .method private hidebysig static void InitobjDemo() cil managed { // Code size 10 (0xa) .maxstack 1 .locals init ([0] valuetype ObjectDemos/InitobjClass x) IL_0000: nop IL_0001: ldloca.s x IL_0003: initobj ObjectDemos/InitobjClass IL_0009: ret } // end of method ObjectDemos::InitobjDemo .method private hidebysig static void IsInstDemo() cil managed { // Code size 37 (0x25) .maxstack 2 .locals init ([0] class ObjectDemos/InstClass x, [1] object y, [2] bool CS$4$0000) IL_0000: nop IL_0001: newobj instance void ObjectDemos/InstClass::.ctor() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: stloc.1 IL_0009: ldloc.1 IL_000a: isinst ObjectDemos/InstClass IL_000f: ldnull IL_0010: cgt.un IL_0012: ldc.i4.0 IL_0013: ceq IL_0015: stloc.2 IL_0016: ldloc.2 IL_0017: brtrue.s IL_0024 IL_0019: ldstr "Is an instance" IL_001e: call void [mscorlib]System.Console::WriteLine(string) IL_0023: nop IL_0024: ret } // end of method ObjectDemos::IsInstDemo .method private hidebysig static void LdelemDemo() cil managed { // Code size 21 (0x15) .maxstack 3 .locals init ([0] string[] strList, [1] string sample) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: newarr [mscorlib]System.String IL_0007: stloc.0 IL_0008: ldloc.0 IL_0009: ldc.i4.0 IL_000a: ldstr "hello" IL_000f: stelem.ref IL_0010: ldloc.0 IL_0011: ldc.i4.0 IL_0012: ldelem.ref IL_0013: stloc.1 IL_0014: ret } // end of method ObjectDemos::LdelemDemo .method private hidebysig static void LdfldDemo() cil managed { // Code size 15 (0xf) .maxstack 1 .locals init ([0] class ObjectDemos/LdfldClass y, [1] int32 z) IL_0000: nop IL_0001: newobj instance void ObjectDemos/LdfldClass::.ctor() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: ldfld int32 ObjectDemos/LdfldClass::x IL_000d: stloc.1 IL_000e: ret } // end of method ObjectDemos::LdfldDemo .method private hidebysig static void LdLenDemo() cil managed { // Code size 13 (0xd) .maxstack 1 .locals init ([0] string[] strList, [1] int32 len) IL_0000: nop IL_0001: ldc.i4.3 IL_0002: newarr [mscorlib]System.String IL_0007: stloc.0 IL_0008: ldloc.0 IL_0009: ldlen IL_000a: conv.i4 IL_000b: stloc.1 IL_000c: ret } // end of method ObjectDemos::LdLenDemo .method private hidebysig static void LdsfldDemo() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init ([0] int32 y) IL_0000: nop IL_0001: ldsfld int32 ObjectDemos/ldsfldClass::x IL_0006: stloc.0 IL_0007: ret } // end of method ObjectDemos::LdsfldDemo .method private hidebysig static void LdstrDemo() cil managed { // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "Hello world" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret } // end of method ObjectDemos::LdstrDemo .method private hidebysig static void NewarrDemo() cil managed { // Code size 17 (0x11) .maxstack 3 .locals init ([0] string[] strList) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: newarr [mscorlib]System.String IL_0007: stloc.0 IL_0008: ldloc.0 IL_0009: ldc.i4.0 IL_000a: ldstr "hello" IL_000f: stelem.ref IL_0010: ret } // end of method ObjectDemos::NewarrDemo .method private hidebysig static void NewobjDemo() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init ([0] class ObjectDemos/NewobjClass x) IL_0000: nop IL_0001: newobj instance void ObjectDemos/NewobjClass::.ctor() IL_0006: stloc.0 IL_0007: ret } // end of method ObjectDemos::NewobjDemo .method private hidebysig static void RethrowDemo() cil managed { // Code size 17 (0x11) .maxstack 2 .locals init ([0] int32 x, [1] int32 y) IL_0000: nop .try { IL_0001: nop IL_0002: ldc.i4.0 IL_0003: stloc.0 IL_0004: ldc.i4.1 IL_0005: ldloc.0 IL_0006: div IL_0007: stloc.1 IL_0008: nop IL_0009: leave.s IL_000f } // end .try catch [mscorlib]System.Exception { IL_000b: pop IL_000c: nop IL_000d: rethrow } // end handler IL_000f: nop IL_0010: ret } // end of method ObjectDemos::RethrowDemo .method private hidebysig static void StelemDemo() cil managed { // Code size 21 (0x15) .maxstack 3 .locals init ([0] string[] strList, [1] string sample) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: newarr [mscorlib]System.String IL_0007: stloc.0 IL_0008: ldloc.0 IL_0009: ldc.i4.0 IL_000a: ldstr "hello" IL_000f: stelem.ref IL_0010: ldloc.0 IL_0011: ldc.i4.0 IL_0012: ldelem.ref IL_0013: stloc.1 IL_0014: ret } // end of method ObjectDemos::StelemDemo .method private hidebysig static void stfldDemo() cil managed { // Code size 15 (0xf) .maxstack 1 .locals init ([0] class ObjectDemos/stfldClass y, [1] int32 z) IL_0000: nop IL_0001: newobj instance void ObjectDemos/stfldClass::.ctor() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: ldfld int32 ObjectDemos/stfldClass::x IL_000d: stloc.1 IL_000e: ret } // end of method ObjectDemos::stfldDemo .method private hidebysig static void StsfldDemo() cil managed { // Code size 8 (0x8) .maxstack 8 IL_0000: nop IL_0001: ldc.i4.5 IL_0002: stsfld int32 ObjectDemos/StsfldClass::x IL_0007: ret } // end of method ObjectDemos::StsfldDemo .method private hidebysig static void ThrowDemo() cil managed { // Code size 20 (0x14) .maxstack 2 .locals init ([0] class [mscorlib]System.Exception ex) IL_0000: nop .try { IL_0001: nop IL_0002: ldstr "Error here" IL_0007: newobj instance void [mscorlib]System.Exception::.ctor(string) IL_000c: throw } // end .try catch [mscorlib]System.Exception { IL_000d: stloc.0 IL_000e: nop IL_000f: nop IL_0010: leave.s IL_0012 } // end handler IL_0012: nop IL_0013: ret } // end of method ObjectDemos::ThrowDemo .method private hidebysig static void UnboxDemo() cil managed { // Code size 16 (0x10) .maxstack 1 .locals init ([0] int32 x) IL_0000: nop IL_0001: ldc.i4.3 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: box [mscorlib]System.Int32 IL_0009: call void ObjectDemos::UnboxMethod(object) IL_000e: nop IL_000f: ret } // end of method ObjectDemos::UnboxDemo .method private hidebysig static void UnboxMethod(object o) cil managed { // Code size 9 (0x9) .maxstack 1 .locals init ([0] int32 y) IL_0000: nop IL_0001: ldarg.0 IL_0002: unbox.any [mscorlib]System.Int32 IL_0007: stloc.0 IL_0008: ret } // end of method ObjectDemos::UnboxMethod .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method ObjectDemos::.ctor } // end of class ObjectDemos .class private auto ansi beforefieldinit AtoFDemos extends [mscorlib]System.Object { .method public hidebysig static void Run() cil managed { // Code size 68 (0x44) .maxstack 0 IL_0000: nop IL_0001: call void AtoFDemos::AddDemo() IL_0006: nop IL_0007: call void AtoFDemos::AddOvfDemo() IL_000c: nop IL_000d: call void AtoFDemos::AddOvfUnDemo() IL_0012: nop IL_0013: call void AtoFDemos::AndDemo() IL_0018: nop IL_0019: call void AtoFDemos::BrBrtrueDemo() IL_001e: nop IL_001f: call void AtoFDemos::BrfalseDemo() IL_0024: nop IL_0025: call void AtoFDemos::CallDemo() IL_002a: nop IL_002b: call void AtoFDemos::CeqDemo() IL_0030: nop IL_0031: call void AtoFDemos::CgtDemo() IL_0036: nop IL_0037: call void AtoFDemos::CltDemo() IL_003c: nop IL_003d: call void AtoFDemos::ConvDemo() IL_0042: nop IL_0043: ret } // end of method AtoFDemos::Run .method private hidebysig static void AddDemo() cil managed { // Code size 72 (0x48) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldc.i4.5 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: add IL_0008: stloc.2 IL_0009: ldstr "z = " IL_000e: ldloca.s z IL_0010: call instance string [mscorlib]System.Int32::ToString() IL_0015: call string [mscorlib]System.String::Concat(string, string) IL_001a: call void [mscorlib]System.Console::WriteLine(string) IL_001f: nop IL_0020: ldc.i4 0x7fffffff IL_0025: stloc.0 IL_0026: ldc.i4 0x7fffffff IL_002b: stloc.1 IL_002c: ldloc.0 IL_002d: ldloc.1 IL_002e: add IL_002f: stloc.2 IL_0030: ldstr "z = " IL_0035: ldloca.s z IL_0037: call instance string [mscorlib]System.Int32::ToString() IL_003c: call string [mscorlib]System.String::Concat(string, string) IL_0041: call void [mscorlib]System.Console::WriteLine(string) IL_0046: nop IL_0047: ret } // end of method AtoFDemos::AddDemo .method private hidebysig static void AddOvfDemo() cil managed { // Code size 98 (0x62) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] class [mscorlib]System.Exception ex) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldc.i4.5 IL_0004: stloc.1 IL_0005: nop IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: add.ovf IL_0009: stloc.2 IL_000a: nop IL_000b: ldstr "z = " IL_0010: ldloca.s z IL_0012: call instance string [mscorlib]System.Int32::ToString() IL_0017: call string [mscorlib]System.String::Concat(string, string) IL_001c: call void [mscorlib]System.Console::WriteLine(string) IL_0021: nop .try { IL_0022: nop IL_0023: ldc.i4 0x7fffffff IL_0028: stloc.0 IL_0029: ldc.i4 0x7fffffff IL_002e: stloc.1 IL_002f: nop IL_0030: ldloc.0 IL_0031: ldloc.1 IL_0032: add.ovf IL_0033: stloc.2 IL_0034: nop IL_0035: nop IL_0036: leave.s IL_0048 } // end .try catch [mscorlib]System.Exception { IL_0038: stloc.3 IL_0039: nop IL_003a: ldloc.3 IL_003b: callvirt instance string [mscorlib]System.Exception::get_Message() IL_0040: call void [mscorlib]System.Console::WriteLine(string) IL_0045: nop IL_0046: leave.s IL_0060 } // end handler IL_0048: nop IL_0049: ldstr "z = " IL_004e: ldloca.s z IL_0050: call instance string [mscorlib]System.Int32::ToString() IL_0055: call string [mscorlib]System.String::Concat(string, string) IL_005a: call void [mscorlib]System.Console::WriteLine(string) IL_005f: nop IL_0060: nop IL_0061: ret } // end of method AtoFDemos::AddOvfDemo .method private hidebysig static void AddOvfUnDemo() cil managed { // Code size 90 (0x5a) .maxstack 2 .locals init ([0] uint32 x, [1] uint32 y, [2] uint32 z, [3] class [mscorlib]System.Exception ex) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldc.i4.5 IL_0004: stloc.1 IL_0005: nop IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: add.ovf.un IL_0009: stloc.2 IL_000a: nop IL_000b: ldstr "z = " IL_0010: ldloca.s z IL_0012: call instance string [mscorlib]System.UInt32::ToString() IL_0017: call string [mscorlib]System.String::Concat(string, string) IL_001c: call void [mscorlib]System.Console::WriteLine(string) IL_0021: nop .try { IL_0022: nop IL_0023: ldc.i4.m1 IL_0024: stloc.0 IL_0025: ldc.i4.m1 IL_0026: stloc.1 IL_0027: nop IL_0028: ldloc.0 IL_0029: ldloc.1 IL_002a: add.ovf.un IL_002b: stloc.2 IL_002c: nop IL_002d: nop IL_002e: leave.s IL_0040 } // end .try catch [mscorlib]System.Exception { IL_0030: stloc.3 IL_0031: nop IL_0032: ldloc.3 IL_0033: callvirt instance string [mscorlib]System.Exception::get_Message() IL_0038: call void [mscorlib]System.Console::WriteLine(string) IL_003d: nop IL_003e: leave.s IL_0058 } // end handler IL_0040: nop IL_0041: ldstr "z = " IL_0046: ldloca.s z IL_0048: call instance string [mscorlib]System.UInt32::ToString() IL_004d: call string [mscorlib]System.String::Concat(string, string) IL_0052: call void [mscorlib]System.Console::WriteLine(string) IL_0057: nop IL_0058: nop IL_0059: ret } // end of method AtoFDemos::AddOvfUnDemo .method private hidebysig static void AndDemo() cil managed { // Code size 33 (0x21) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldc.i4.5 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: and IL_0008: stloc.2 IL_0009: ldstr "z = " IL_000e: ldloca.s z IL_0010: call instance string [mscorlib]System.Int32::ToString() IL_0015: call string [mscorlib]System.String::Concat(string, string) IL_001a: call void [mscorlib]System.Console::WriteLine(string) IL_001f: nop IL_0020: ret } // end of method AtoFDemos::AndDemo .method private hidebysig static void BrBrtrueDemo() cil managed { // Code size 48 (0x30) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] bool CS$4$0000) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldc.i4.2 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: cgt IL_0009: ldc.i4.0 IL_000a: ceq IL_000c: stloc.3 IL_000d: ldloc.3 IL_000e: brtrue.s IL_0015 IL_0010: ldc.i4.s 20 IL_0012: stloc.2 IL_0013: br.s IL_0018 IL_0015: ldc.i4.s 10 IL_0017: stloc.2 IL_0018: ldstr "z = " IL_001d: ldloca.s z IL_001f: call instance string [mscorlib]System.Int32::ToString() IL_0024: call string [mscorlib]System.String::Concat(string, string) IL_0029: call void [mscorlib]System.Console::WriteLine(string) IL_002e: nop IL_002f: ret } // end of method AtoFDemos::BrBrtrueDemo .method private hidebysig static void BrfalseDemo() cil managed { // Code size 20 (0x14) .maxstack 1 .locals init ([0] bool x, [1] bool CS$4$0000) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: stloc.1 IL_0005: ldloc.1 IL_0006: brtrue.s IL_0013 IL_0008: ldstr "BrfalseDemo - false detected" IL_000d: call void [mscorlib]System.Console::WriteLine(string) IL_0012: nop IL_0013: ret } // end of method AtoFDemos::BrfalseDemo .method private hidebysig static void CallDemo() cil managed { // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "using the call instruction" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret } // end of method AtoFDemos::CallDemo .method private hidebysig static void CgtDemo() cil managed { // Code size 48 (0x30) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] bool CS$4$0000) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldc.i4.2 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: cgt IL_0009: ldc.i4.0 IL_000a: ceq IL_000c: stloc.3 IL_000d: ldloc.3 IL_000e: brtrue.s IL_0015 IL_0010: ldc.i4.s 20 IL_0012: stloc.2 IL_0013: br.s IL_0018 IL_0015: ldc.i4.s 10 IL_0017: stloc.2 IL_0018: ldstr "z = " IL_001d: ldloca.s z IL_001f: call instance string [mscorlib]System.Int32::ToString() IL_0024: call string [mscorlib]System.String::Concat(string, string) IL_0029: call void [mscorlib]System.Console::WriteLine(string) IL_002e: nop IL_002f: ret } // end of method AtoFDemos::CgtDemo .method private hidebysig static void CeqDemo() cil managed { // Code size 48 (0x30) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] bool CS$4$0000) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldc.i4.2 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: ceq IL_0009: ldc.i4.0 IL_000a: ceq IL_000c: stloc.3 IL_000d: ldloc.3 IL_000e: brtrue.s IL_0015 IL_0010: ldc.i4.s 20 IL_0012: stloc.2 IL_0013: br.s IL_0018 IL_0015: ldc.i4.s 10 IL_0017: stloc.2 IL_0018: ldstr "z = " IL_001d: ldloca.s z IL_001f: call instance string [mscorlib]System.Int32::ToString() IL_0024: call string [mscorlib]System.String::Concat(string, string) IL_0029: call void [mscorlib]System.Console::WriteLine(string) IL_002e: nop IL_002f: ret } // end of method AtoFDemos::CeqDemo .method private hidebysig static void CltDemo() cil managed { // Code size 45 (0x2d) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] bool CS$4$0000) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldc.i4.2 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: clt IL_0009: stloc.3 IL_000a: ldloc.3 IL_000b: brtrue.s IL_0012 IL_000d: ldc.i4.s 20 IL_000f: stloc.2 IL_0010: br.s IL_0015 IL_0012: ldc.i4.s 10 IL_0014: stloc.2 IL_0015: ldstr "z = " IL_001a: ldloca.s z IL_001c: call instance string [mscorlib]System.Int32::ToString() IL_0021: call string [mscorlib]System.String::Concat(string, string) IL_0026: call void [mscorlib]System.Console::WriteLine(string) IL_002b: nop IL_002c: ret } // end of method AtoFDemos::CltDemo .method private hidebysig static void ConvDemo() cil managed { // Code size 7 (0x7) .maxstack 1 .locals init ([0] int16 x, [1] int64 y) IL_0000: nop IL_0001: ldc.i4.8 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: conv.i8 IL_0005: stloc.1 IL_0006: ret } // end of method AtoFDemos::ConvDemo .method private hidebysig static void DivDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 103 IL_0006: stloc.1 IL_0007: ldloc.1 IL_0008: ldloc.0 IL_0009: div IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::DivDemo .method private hidebysig static void LdargDemo() cil managed { // Code size 18 (0x12) .maxstack 8 IL_0000: nop IL_0001: ldstr "one" IL_0006: ldc.i4 0xea IL_000b: call void AtoFDemos::LdargParentMethod(string, int32) IL_0010: nop IL_0011: ret } // end of method AtoFDemos::LdargDemo .method private hidebysig static void LdargParentMethod(string param1, int32 param2) cil managed { // Code size 9 (0x9) .maxstack 8 IL_0000: nop IL_0001: ldarg.0 IL_0002: call void AtoFDemos::LdargChildMethod(string) IL_0007: nop IL_0008: ret } // end of method AtoFDemos::LdargParentMethod .method private hidebysig static void LdargChildMethod(string param1) cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method AtoFDemos::LdargChildMethod .method private hidebysig static void LdlocaDemo() cil managed { // Code size 16 (0x10) .maxstack 1 .locals init ([0] int32 x) IL_0000: nop IL_0001: ldc.i4 0x1f4 IL_0006: stloc.0 IL_0007: ldloca.s x IL_0009: call void AtoFDemos::LocaParentMethod(int32&) IL_000e: nop IL_000f: ret } // end of method AtoFDemos::LdlocaDemo .method private hidebysig static void LocaParentMethod(int32& param1) cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method AtoFDemos::LocaParentMethod .method private hidebysig static void LdcDemo() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init ([0] int32 x) IL_0000: nop IL_0001: ldc.i4 0x1f4 IL_0006: stloc.0 IL_0007: ret } // end of method AtoFDemos::LdcDemo .method private hidebysig static void LdlocDemo() cil managed { // Code size 10 (0xa) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldc.i4.5 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: add IL_0008: stloc.2 IL_0009: ret } // end of method AtoFDemos::LdlocDemo .method private hidebysig static void LdnullDemo() cil managed { // Code size 9 (0x9) .maxstack 8 IL_0000: nop IL_0001: ldnull IL_0002: call void AtoFDemos::NullParamMethod(string) IL_0007: nop IL_0008: ret } // end of method AtoFDemos::LdnullDemo .method private hidebysig static void NullParamMethod(string param) cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method AtoFDemos::NullParamMethod .method private hidebysig static void LeaveDemo() cil managed { // Code size 42 (0x2a) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z, [3] class [mscorlib]System.Exception ex) IL_0000: nop .try { IL_0001: nop IL_0002: ldc.i4 0x7fffffff IL_0007: stloc.0 IL_0008: ldc.i4 0x7fffffff IL_000d: stloc.1 IL_000e: nop IL_000f: ldloc.0 IL_0010: ldloc.1 IL_0011: add.ovf IL_0012: stloc.2 IL_0013: nop IL_0014: nop IL_0015: leave.s IL_0027 } // end .try catch [mscorlib]System.Exception { IL_0017: stloc.3 IL_0018: nop IL_0019: ldloc.3 IL_001a: callvirt instance string [mscorlib]System.Exception::get_Message() IL_001f: call void [mscorlib]System.Console::WriteLine(string) IL_0024: nop IL_0025: leave.s IL_0028 } // end handler IL_0027: nop IL_0028: nop IL_0029: ret } // end of method AtoFDemos::LeaveDemo .method private hidebysig static void MulDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 103 IL_0006: stloc.1 IL_0007: ldloc.1 IL_0008: ldloc.0 IL_0009: mul IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::MulDemo .method private hidebysig static void NegDemo() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init ([0] int32 x, [1] int32 y) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldloc.0 IL_0005: neg IL_0006: stloc.1 IL_0007: ret } // end of method AtoFDemos::NegDemo .method private hidebysig static void NotDemo() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init ([0] int32 x, [1] int32 y) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldloc.0 IL_0005: not IL_0006: stloc.1 IL_0007: ret } // end of method AtoFDemos::NotDemo .method private hidebysig static void OrDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 10 IL_0006: stloc.1 IL_0007: ldloc.0 IL_0008: ldloc.1 IL_0009: or IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::OrDemo .method private hidebysig static void RemDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 10 IL_0006: stloc.1 IL_0007: ldloc.0 IL_0008: ldloc.1 IL_0009: rem IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::RemDemo .method private hidebysig static void ShlDemo() cil managed { // Code size 9 (0x9) .maxstack 2 .locals init ([0] int32 x, [1] int32 y) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldloc.0 IL_0005: ldc.i4.3 IL_0006: shl IL_0007: stloc.1 IL_0008: ret } // end of method AtoFDemos::ShlDemo .method private hidebysig static void ShrDemo() cil managed { // Code size 9 (0x9) .maxstack 2 .locals init ([0] int32 x, [1] int32 y) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldloc.0 IL_0005: ldc.i4.3 IL_0006: shr IL_0007: stloc.1 IL_0008: ret } // end of method AtoFDemos::ShrDemo .method private hidebysig static void StindDemo() cil managed { // Code size 13 (0xd) .maxstack 1 .locals init ([0] int32 one) IL_0000: nop IL_0001: ldc.i4.s 34 IL_0003: stloc.0 IL_0004: ldloca.s one IL_0006: call void AtoFDemos::StindParentMethod(int32&) IL_000b: nop IL_000c: ret } // end of method AtoFDemos::StindDemo .method private hidebysig static void StindParentMethod(int32& param) cil managed { // Code size 5 (0x5) .maxstack 8 IL_0000: nop IL_0001: ldarg.0 IL_0002: ldc.i4.4 IL_0003: stind.i4 IL_0004: ret } // end of method AtoFDemos::StindParentMethod .method private hidebysig static void StlocDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 103 IL_0006: stloc.1 IL_0007: ldloc.1 IL_0008: ldloc.0 IL_0009: sub IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::StlocDemo .method private hidebysig static void SubDemo() cil managed { // Code size 12 (0xc) .maxstack 2 .locals init ([0] int32 x, [1] int32 y, [2] int32 z) IL_0000: nop IL_0001: ldc.i4.s 23 IL_0003: stloc.0 IL_0004: ldc.i4.s 103 IL_0006: stloc.1 IL_0007: ldloc.1 IL_0008: ldloc.0 IL_0009: sub IL_000a: stloc.2 IL_000b: ret } // end of method AtoFDemos::SubDemo .method private hidebysig static void SwitchDemo() cil managed { // Code size 63 (0x3f) .maxstack 2 .locals init ([0] int32 x, [1] int32 CS$4$0000) IL_0000: nop IL_0001: ldc.i4.2 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: stloc.1 IL_0005: ldloc.1 IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch ( IL_0017, IL_0024) IL_0015: br.s IL_0031 IL_0017: ldstr "1" IL_001c: call void [mscorlib]System.Console::WriteLine(string) IL_0021: nop IL_0022: br.s IL_003e IL_0024: ldstr "2" IL_0029: call void [mscorlib]System.Console::WriteLine(string) IL_002e: nop IL_002f: br.s IL_003e IL_0031: ldstr "Unknown" IL_0036: call void [mscorlib]System.Console::WriteLine(string) IL_003b: nop IL_003c: br.s IL_003e IL_003e: ret } // end of method AtoFDemos::SwitchDemo .method private hidebysig static void XorDemo() cil managed { // Code size 10 (0xa) .maxstack 2 .locals init ([0] bool x, [1] bool y, [2] bool z) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldc.i4.1 IL_0004: stloc.1 IL_0005: ldloc.0 IL_0006: ldloc.1 IL_0007: xor IL_0008: stloc.2 IL_0009: ret } // end of method AtoFDemos::XorDemo .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method AtoFDemos::.ctor } // end of class AtoFDemos