次の方法で共有


StructLayoutAttribute.Pack フィールド

メモリ内のクラスまたは構造体のデータ フィールドのアライメントを制御します。

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

解説

このフィールドは、 LayoutKind.Sequential 値を指定する場合に使用するパッキング サイズを示します。 Pack の値は、0、1、2、4、8、16、32、64、128 のいずれかにする必要があります。値が 0 の場合は、パッキング アライメントが現在のプラットフォームの既定値に設定されていることを示します。

既定のパッキング サイズは 8 です。ただし、アンマネージ構造体の既定のパッキング サイズは 4 であることが一般的です。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, Common Language Infrastructure (CLI) Standard

参照

StructLayoutAttribute クラス | StructLayoutAttribute メンバ | System.Runtime.InteropServices 名前空間