M_Cyjb_Reflection_ILGeneratorUtil_EmitConversion - CYJB/Cyjb GitHub Wiki
将栈顶的对象从 inputType 转换为 outputType。
Namespace: Cyjb.Reflection
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public static void EmitConversion(
this ILGenerator il,
Type inputType,
Type outputType,
bool isChecked
)
- il
- Type: System.Reflection.Emit.ILGenerator
IL 指令生成器。 - inputType
- Type: System.Type
要转换的对象的类型。 - outputType
- Type: System.Type
要将输入对象转换到的类型。 - isChecked
- Type: System.Boolean
是否执行溢出检查。
在 Visual Basic 和 C# 中,这个方法可以当成为类型ILGenerator的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic) 或 扩展方法 (C# 编程指南) 获取更多信息。
异常 | 条件 |
---|---|
ArgumentNullException |
il 为 null 。 |
ArgumentNullException |
inputType 为 null 。 |
ArgumentNullException |
outputType 为 null 。 |
ArgumentException | inputType 包含泛型参数。 |
ArgumentException | outputType 包含泛型参数。 |