メソッドの命令を編集するアプリケーションを .NET で作成しています。OpCodeにldstr、Operandに文字列を入れたいです。Mono.Cecil を使用すると Operand を設定できますが、問題は OpCode が ReadOnly プロパティであることです。OpCode を編集する方法はありますか? これには、次のコードを使用します。
Dim assembly1 As AssemblyDefinition
assembly1 = AssemblyDefinition.ReadAssembly(rute)
For Each modDef In assembly1.Modules
For Each typeDef In modDef.Types
For Each mDef In typeDef.Methods
For i = 0 To mDef.Body.Instructions.Count - 1
mDef.Body.Instructions(i).OpCode.Code = Mono.Cecil.Cil.Code.ldstr
mDef.Body.Instructions(i).Operand = "Text"
Next
Next
Next
Next
どうもありがとう!