This documentation is archived and is not being maintained.

StructLayoutAttribute.Size Field

Indicates the absolute size of the class or structure.

[Visual Basic]
Public Size As Integer
public int Size;
public: int Size;
public var Size : int;


Must be greater or equal to the sum of all members. This field is primarily for compiler writers to specify the total size (in bytes) of the class or structure, and is useful for extending 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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

StructLayoutAttribute Class | StructLayoutAttribute Members | System.Runtime.InteropServices Namespace