This documentation is archived and is not being maintained.

StructLayoutAttribute.Pack Field

Controls the alignment of data fields of a class or structure in memory.

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


This field indicates the packing size that should be used when the LayoutKind.Sequential value is specified. The value of Pack must be 0, 1, 2, 4, 8, 16, 32, 64, or 128. A value of 0 indicates that the packing alignment is set to the default for the current platform.

The default packing size is 8, except for unmanaged structures that typically have a default packing size of 4.


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

See Also

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