OpCodes.Refanyval 字段

定义

检索嵌入在类型化引用内的地址(& 类型)。Retrieves the address (type &) embedded in a typed reference.

public: static initonly System::Reflection::Emit::OpCode Refanyval;
public static readonly System.Reflection.Emit.OpCode Refanyval;
 staticval mutable Refanyval : System.Reflection.Emit.OpCode
Public Shared ReadOnly Refanyval As OpCode 

字段值

注解

下表列出了指令的十六进制和 Microsoft 中间语言(MSIL)程序集格式以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 程序集格式Assembly Format 说明Description
C2 < T >C2 < T > refanyval typerefanyval type 推送在类型化引用中存储的地址。Pushes the address stored in a typed reference.

堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:

  1. 值类型引用被推送到堆栈上。A value type reference is pushed onto the stack.

  2. 从堆栈中弹出类型化引用和检索到相应的地址。The typed reference is popped from the stack and the corresponding address retrieved.

  3. 该地址将被推送到堆栈上。The address is pushed onto the stack.

类型化引用包含对象实例的类型标记和地址。A typed reference contains a type token and an address to an object instance.

@No__t-0 指令检索嵌入在类型化引用中的地址。The refanyval instruction retrieves the address embedded in the a typed reference. 在堆栈上提供的类型化引用中嵌入的类型必须与 type (元数据标记,typedeftyperef)指定的类型匹配。The type embedded in the typed reference supplied on the stack must match the type specified by type (a metadata token, either a typedef or a typeref). 请参阅 Mkrefany 说明了解相关内容。See the Mkrefany instruction for related content.

如果 type 与类型引用中存储的类型不完全相同(在这种情况下,则会引发 InvalidCastExceptiontype 是为构造所说的类型化引用的 @no__t 3 指令提供的类。)InvalidCastException is thrown if type is not identical to the type stored in the type reference (in this case, type is the class supplied to the Mkrefany instruction that constructed said typed reference).

如果找不到 type,则会引发 @no__t。TypeLoadException is thrown if type cannot be found.

以下 @no__t 0 方法重载可以使用 @no__t 操作码:The following Emit method overload can use the refanyval opcode:

  • ILGenerator (OpCode,Type)ILGenerator.Emit(OpCode, Type)

适用于