OpCodes.Stsfld 字段
定义
用来自计算堆栈的值替换静态字段的值。Replaces the value of a static field with a value from the evaluation stack.
public: static initonly System::Reflection::Emit::OpCode Stsfld;
public static readonly System.Reflection.Emit.OpCode Stsfld;
staticval mutable Stsfld : System.Reflection.Emit.OpCode
Public Shared ReadOnly Stsfld 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 |
|---|---|---|
80 < T >80 < T > |
stsfld fieldstsfld field |
将中的值替换 field 为提供的值。Replaces the value in field with a supplied value. |
堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:
将值推送到堆栈上。A value is pushed onto the stack.
从堆栈中弹出一个值并将其存储在中
field。A value is popped from the stack and stored infield.
stsfld指令用来自堆栈的值替换静态字段的值。The stsfld instruction replaces the value of a static field with a value from the stack. field 必须引用静态字段成员的元数据标记。field is a metadata token that must refer to a static field member.
stsfld指令可以为前缀 Volatile 。The stsfld instruction may be prefixed by Volatile.
MissingFieldException 如果在元数据中找不到字段,则会引发。MissingFieldException 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 run time.
以下 Emit 方法重载可以使用 stsfld 操作码:The following Emit method overload can use the stsfld opcode: