Hemalatha Sunnapu

Hemalatha Sunnapu

  • NA
  • 169
  • 20.3k

Why box field is required in integer in ILDASM

Jul 4 2018 4:55 AM
.method public hidebysig instance void fun(string h) cil managed
{
// Code size 133 (0x85)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldstr "base called from "
IL_0006: ldarg.0
IL_0007: ldfld int64 ConsoleApp6.Base::x
IL_000c: box [System.Runtime]System.Int64
IL_0011: call string [System.Runtime]System.String::Concat(object,
object)
IL_0016: call void [System.Console]System.Console::Write(string)
IL_001b: nop
IL_001c: nop
IL_001d: ldstr "x value next after declartion is"
IL_0022: ldarg.0
IL_0023: ldfld int64 ConsoleApp6.Base::x
IL_0028: box [System.Runtime]System.Int64
IL_002d: call string [System.Runtime]System.String::Concat(object,
object)

Answers (7)