RollRoll
RollRoll

Reputation: 8472

What are those symbols in IL code?

What is this symbol ( IL_0000 etc) in the IL code. its this the real memory heap address?

  IL_0000:  nop
  IL_0001:  ldstr      "here is something"
  IL_0006:  call       void [mscorlib]System.Console::WriteLine(string)
  IL_000b:  nop
  IL_000c:  ldc.i4.s   18
  IL_000e:  newobj     instance void Proj.Stock::.ctor(int32)
  IL_0013:  stloc.0
  IL_0014:  ldstr      "another"
  IL_0019:  call       void [mscorlib]System.Console::WriteLine(string)
  IL_001e:  nop
  IL_001f:  ldstr      "and even more"
  IL_0024:  call       void [mscorlib]System.Console::WriteLine(string)
  IL_0029:  nop
  IL_002a:  ret

Upvotes: 1

Views: 826

Answers (1)

Matthew Whited
Matthew Whited

Reputation: 22443

The IL_0000: is a Code Label. It's really just an identifier so you can easily reference jump locations by name instead of by byte count.

See the Common Language Infrastructure (CLI) standard documents. ECMA-335 section II.5.4

II.5.4 Labels and l ists of labels

Labels are provided as a programming convenience; they represent a number that is encoded in the metadata. The value represented by a label is typically an offset in bytes from the beginning of the current method, although the precise encoding differs depending on where in the logical metadata structure or CIL stream the label occurs.

...

Upvotes: 4

Related Questions