FieldOffsetAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Field, Inherited:=False)> _ Public NotInheritable Class FieldOffsetAttribute Inherits Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)] public sealed class FieldOffsetAttribute : Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Field, Inherited=false)] public ref class FieldOffsetAttribute sealed : public Attribute

この属性は、System.Runtime.InteropServices.StructLayoutAttribute の LayoutKind.Explicit がコンストラクタに渡されたときに使用され、クラスまたは構造体に適用して、そのクラスまたは構造体のアンマネージ表現内の各非 static メンバまたは定数メンバのオフセットを指定します。

明示的なレイアウトを持つクラスのメンバに FieldOffsetAttribute を適用する方法を次の例に示します。
<StructLayout(LayoutKind.Explicit)> _ Public Class SYSTEM_INFO <FieldOffset(0)> Private OemId As System.UInt64 <FieldOffset(4)> Private PageSize As System.UInt64 <FieldOffset(16)> Private ActiveProcessorMask As System.UInt64 <FieldOffset(20)> Private NumberOfProcessors As System.UInt64 <FieldOffset(24)> Private ProcessorType As System.UInt64 End Class
[StructLayout(LayoutKind.Explicit)] public class SYSTEM_INFO { [FieldOffset(0)] public ulong OemId; [FieldOffset(4)] public ulong PageSize; [FieldOffset(16)] public ulong ActiveProcessorMask; [FieldOffset(20)] public ulong NumberOfProcessors; [FieldOffset(24)] public ulong ProcessorType; }
[StructLayout(LayoutKind::Explicit)] public ref class SYSTEM_INFO { public: [FieldOffset(0)] UInt64 OemId; [FieldOffset(4)] UInt64 PageSize; [FieldOffset(16)] UInt64 ActiveProcessorMask; [FieldOffset(20)] UInt64 NumberOfProcessors; [FieldOffset(24)] UInt64 ProcessorType; };
/** @attribute StructLayout(LayoutKind.Explicit) */ public class SYSTEM_INFO { /** @attribute FieldOffset(0) */ public long oemId; /** @attribute FieldOffset(4) */ public long pageSize; /** @attribute FieldOffset(16) */ public long activeProcessorMask; /** @attribute FieldOffset(20) */ public long numberOfProcessors; /** @attribute FieldOffset(24) */ public long processorType; } //SYSTEM_INFO

System.Attribute
System.Runtime.InteropServices.FieldOffsetAttribute


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


FieldOffsetAttribute コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


FieldOffsetAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Value | 構造体の先頭からフィールドの先頭までのオフセットを取得します。 |

FieldOffsetAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

FieldOffsetAttribute メンバ
クラスまたは構造体のアンマネージ表現内にあるフィールドの物理的な位置を示します。
FieldOffsetAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Value | 構造体の先頭からフィールドの先頭までのオフセットを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

- FieldOffsetAttributeのページへのリンク