OpCodes.Sizeof 字段

定义

将提供的值类型的大小(以字节为单位)推送到计算堆栈上。Pushes the size, in bytes, of a supplied value type onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Sizeof;
public static readonly System.Reflection.Emit.OpCode Sizeof;
 staticval mutable Sizeof : System.Reflection.Emit.OpCode
Public Shared ReadOnly Sizeof 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
FE 1C < T >FE 1C < T > sizeof valTypesizeof valType 将值类型的大小(以字节为单位) @no__t 为0。Push the size, in bytes, of a value type as an unsigned int32.

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

  1. 将提供的值类型(valType)的大小(以字节为单位)推送到堆栈上。The size (in bytes) of the supplied value type (valType) is pushed onto the stack.

valType 必须是指定值类型、引用类型或泛型类型参数的元数据标记(@no__t 1 或 typedef)。valType must be a metadata token (a typeref or typedef) that specifies a value type, reference type, or generic type parameter.

对于引用类型,返回的大小为相应类型的引用值的大小(32位系统上为4个字节),而不是存储在引用值引用的对象中的数据的大小。For a reference type, the size returned is the size of a reference value of the corresponding type (4 bytes on 32-bit systems), not the size of the data stored in objects referred to by the reference value. 泛型类型参数只能在定义它的类型或方法的主体中使用。A generic type parameter can be used only in the body of the type or method that defines it. 当对该类型或方法进行实例化时,泛型类型参数被替换为值类型或引用类型。When that type or method is instantiated, the generic type parameter is replaced by a value type or reference type.

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

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

适用于

另请参阅