开发者

IL Opcode Modification

Language: VB.NET 3.5

IL op开发者_开发知识库codes:

    718 ldarg.0 
    719 callvirt    System.Windows.Forms.Button RClient.RClient::get_cmd1()
    724 ldarg.0 
    725 ldfld       System.String[] RClient.RClient::ButtonStrings
    730 ldc.i4.5    
    731 ldelem.ref  
    732 callvirt    System.Void System.Windows.Forms.ButtonBase::set_Text(System.String)
    737 ldarg.0 

Corresponds to:

Me.cmd1.Text = Me.ButtonStrings(5)

At least I believe it does. What changes to the IL would I have to make to reflect this instead:

Me.cmd1.Text = "some string"


ldarg.0 
callvirt    System.Windows.Forms.Button RClient.RClient::get_cmd1()
ldstr      "some string"
callvirt    System.Void System.Windows.Forms.ButtonBase::set_Text(System.String)

Line 1 pushes Me onto the stack. Line 2 executes the method get_cmd1 which corresponds to the getter for the property cmd1 for the object on the top of the stack. So, this line pushes the result of the getter cmd1 from the object on the top of the stack, popping the top of the stack in the process. Line 3 pushes the string "some string" on the stack. At this point the top of the stack is the string "some string" and the next item on the stack is Me.cmd1. Line 4 executes the method set_Text with string parameter being the top of the stack. This corresponds to the setter for Text for the second item on the stack. The second item on the stack is Me.cmd1. So these lines are equivalent to Me.cmd1.Text = "some string".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜