我需要在IL代码中创建一个新的void方法,但我不知道如何在语句“returnType as Mono.Cecil.TypeReference”中声明类型Void ??????下面的代码
Dim MethodAtt = Mono.Cecil.MethodAttributes.Public Or Mono.Cecil.MethodAttributes.HideBySig Or Mono.Cecil.MethodAttributes.SpecialName Or Mono.Cecil.MethodAttributes.RTSpecialName
Dim newm As New MethodDefinition("nuovo_method", MethodAtt, ??????)
由于
答案 0 :(得分:4)
我希望我已经解决了!
您必须从moduledefinition
导入Void类型Dim name = ModuleDefinition.ReadModule(currentname)
.
.
.
Dim voidtype As TypeReference = name.Import(GetType(Void))
Dim newm As New MethodDefinition("nuovo_method", MethodAtt, voidtype )