can instruction number be accessed in MSIL?

Hi,

I have got two questions.

1. Can instruction number that is number that appears before opcode that starts with IL_xxxx be accessed? If so how can it be accessed?

for example

IL_0017: callvirt Void [System.Data] System.Data.SqlClient.SqlConnection.Open()

i need to access the part marked with red background.

2. Also can the instruction number after Br statement be accessed?

for example

IL_003c: brfalse.sIL_0044

how can the part marked with red background accessed?

Thanks,

[710 byte] By [Guns] at [2007-12-21]
# 1

Hi Guns,

use Instruction.Offset

Regards,

Jeffrey

JeffreyvanGogh-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 2

Hi Jeffrey,

Thanks a lot for your help but can i get the IL instruction number that is after br statement with the help instruction.offset?

That is in the instruction

IL_008 br.s IL_023.

Can i get the instruction number marked with red back ground using instruction.offset?

Thanks,

Guns at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 3

the Instruction object has a Value property, that contains an integral value for all branch instructions:



int jumpOffset = (int)instruction.Value

Regards,

Jeffrey

JeffreyvanGogh-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...

Visual Studio Team System

Site Classified