M_Cyjb_Reflection_ILGeneratorUtil_EmitCall_7 - CYJB/Cyjb GitHub Wiki
调用指定的方法(自动决定 call/callvirt)。
Namespace: Cyjb.Reflection
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public static void EmitCall(
this ILGenerator il,
Type instanceType,
MethodInfo method,
params Type[]? parameterTypes
)
- il
- Type: System.Reflection.Emit.ILGenerator
IL 指令生成器。 - instanceType
- Type: System.Type
要调用方法的实例类型;如果 method 是静态方法, 则忽略该参数。 - method
- Type: System.Reflection.MethodInfo
要调用的方法。 - parameterTypes
- Type: System.Type[]
参数的类型;如果 method 不是可变参数方法, 则忽略该参数。
在 Visual Basic 和 C# 中,这个方法可以当成为类型ILGenerator的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic) 或 扩展方法 (C# 编程指南) 获取更多信息。
异常 | 条件 |
---|---|
ArgumentNullException |
il 为 null 。 |
ArgumentNullException |
method 为 null 。 |