OpCodes.Ldsflda 字段

定义

将静态字段的地址推送到计算堆栈上。Pushes the address of a static field onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Ldsflda;
public static readonly System.Reflection.Emit.OpCode Ldsflda;
 staticval mutable Ldsflda : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldsflda 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
7F < T >7F < T > ldsflda fieldldsflda field 在堆栈上推送 @no__t 的地址Push the address of field on the stack

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

  1. 将特定字段的地址推送到堆栈上。The address of a specific field is pushed onto the stack.

@No__t-0 指令将静态(在类的所有实例中共享)字段的地址推送到堆栈上。The ldsflda instruction pushes the address of a static (shared among all instances of a class) field on the stack. 如果元数据标记 field 引用其内存被管理的类型,则该地址可以表示为暂时性指针(类型 *)。The address may be represented as a transient pointer (type *) if the metadata token field refers to a type whose memory is managed. 否则,它对应于非托管指针(类型 native int)。Otherwise, it corresponds to an unmanaged pointer (type native int). 请注意,field 可以是静态全局的,它具有分配的相对虚拟地址(该字段的偏移量,其中其包含的 PE 文件将加载到内存中),其中内存是非托管的。Note that field may be a static global with an assigned relative virtual address (the offset of the field from the base address at which its containing PE file is loaded into memory) where the memory is unmanaged.

@No__t-0 指令可以具有 @no__t 1 前缀。The ldsflda instruction can have a Volatile prefix.

如果在元数据中找不到字段,则会引发 MissingFieldExceptionMissingFieldException is thrown if field is not found in the metadata. 当 Microsoft 中间语言(MSIL)指令转换为本机代码而不是运行时,通常会检查此情况。This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at runtime.

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

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

适用于