Skip to content

M_Cyjb_Reflection_ILGeneratorUtil_EmitLoadArg_2

CYJB edited this page Mar 20, 2024 · 13 revisions

ILGeneratorUtil.EmitLoadArg 方法 (ILGenerator, Int32, Type, Type, Boolean)

加载指定索引的参数,并转换为指定类型。

Namespace: Cyjb.Reflection
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public static void EmitLoadArg(
	this ILGenerator il,
	int index,
	Type paramType,
	Type targetType,
	bool isChecked
)

参数

 

il
Type: System.Reflection.Emit.ILGenerator
IL 指令生成器。
index
Type: System.Int32
要加载的参数索引。
paramType
Type: System.Type
要加载的参数类型。
targetType
Type: System.Type
要转换到的类型。
isChecked
Type: System.Boolean
是否执行溢出检查。

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型ILGenerator的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

Exceptions

 

异常 条件
ArgumentNullException ilnull
ArgumentOutOfRangeException index 小于 0
ArgumentNullException paramTypenull
ArgumentNullException targetTypenull
ArgumentException paramType 包含泛型参数。
ArgumentException targetType 包含泛型参数。

Remarks

会根据 index 的值,选择最合适的 IL 指令。

参见

Reference

ILGeneratorUtil 类
EmitLoadArg 重载
Cyjb.Reflection 命名空间

Clone this wiki locally