Export (0) Print
Expand All

StructLayoutAttribute.Pack Field

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

[Visual Basic]
Public Pack As Integer
[C#]
public int Pack;
[C++]
public: int Pack;
[JScript]
public var Pack : int;

Remarks

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.

Requirements

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

Show:
© 2014 Microsoft