Skip to content

Instantly share code, notes, and snippets.


gdyrrahitis/boxing.cs Secret

Created Jun 22, 2019
What would you like to do?
.method public hidebysig
instance void CastingInterface () cil managed
// Method begins at RVA 0x2068
// Code size 27 (0x1b)
.maxstack 2
.locals init (
[0] object
IL_0000: ldc.i4.s 10
IL_0002: box [System.Runtime]System.Int32 // Boxes the num1 integer - No surprise here
IL_0007: stloc.0
IL_0008: ldc.i4.s 12
IL_000a: box [System.Runtime]System.Int32 // Boxes the num2 integer - Casted to an interface
IL_000f: ldloc.0
IL_0010: callvirt instance int32 [System.Runtime]System.IComparable::CompareTo(object)
IL_0015: call void [System.Console]System.Console::WriteLine(int32)
IL_001a: ret
} // end of method Class2::CastingInterface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment