StructLayoutAttribute.Size Field

Definition

指示类或结构的绝对大小。Indicates the absolute size of the class or structure.

public: int Size;
public int Size;
val mutable Size : int
Public Size As Integer 

Field Value

Int32

Remarks

此字段必须等于或大于类或结构的成员的总大小(以字节为单位)。This field must be equal or greater than the total size, in bytes, of the members of the class or structure. 此字段主要适用于想要扩展结构占用的内存以实现直接的非托管访问的编译器编写器。This field is primarily for compiler writers who want to extend the memory occupied by a structure for direct, unmanaged access. 例如,在使用不直接在元数据中表示的联合时,可以使用此字段。For example, you can use this field when working with unions that are not represented in metadata directly.

Applies to