Language: VB.NET 3.5
IL opcodes:
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"
Line 1 pushes
Meonto the stack. Line 2 executes the methodget_cmd1which corresponds to the getter for the propertycmd1for the object on the top of the stack. So, this line pushes the result of the gettercmd1from 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 isMe.cmd1. Line 4 executes the methodset_Textwith string parameter being the top of the stack. This corresponds to the setter forTextfor the second item on the stack. The second item on the stack isMe.cmd1. So these lines are equivalent toMe.cmd1.Text = "some string".