FieldOffsetAttributeとは? わかりやすく解説

FieldOffsetAttribute クラス

クラスまたは構造体のアンマネージ表現内にあるフィールド物理的な位置示します

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Field, Inherited:=False)> _
Public NotInheritable Class
 FieldOffsetAttribute
    Inherits Attribute
Dim instance As FieldOffsetAttribute
[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
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)
 */ 
public final class FieldOffsetAttribute extends
 Attribute
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)
 
public final class FieldOffsetAttribute extends
 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.Object
   System.Attribute
    System.Runtime.InteropServices.FieldOffsetAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FieldOffsetAttribute メンバ
System.Runtime.InteropServices 名前空間
StructLayoutAttribute
LayoutKind

FieldOffsetAttribute コンストラクタ

フィールド先頭対す構造体でのオフセット指定して、FieldOffsetAttribute クラス新しインスタンス初期化します。

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim offset As Integer

Dim instance As New FieldOffsetAttribute(offset)
public FieldOffsetAttribute (
    int offset
)
public:
FieldOffsetAttribute (
    int offset
)
public FieldOffsetAttribute (
    int offset
)
public function FieldOffsetAttribute (
    offset : int
)

パラメータ

offset

構造体先頭からフィールド先頭までのバイト単位オフセット

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FieldOffsetAttribute クラス
FieldOffsetAttribute メンバ
System.Runtime.InteropServices 名前空間

FieldOffsetAttribute プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

FieldOffsetAttribute クラス
System.Runtime.InteropServices 名前空間
StructLayoutAttribute
LayoutKind

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 クラス
System.Runtime.InteropServices 名前空間
StructLayoutAttribute
LayoutKind

FieldOffsetAttribute メンバ

クラスまたは構造体のアンマネージ表現内にあるフィールド物理的な位置示します

FieldOffsetAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド FieldOffsetAttribute フィールド先頭対す構造体でのオフセット指定して、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 クラス
System.Runtime.InteropServices 名前空間
StructLayoutAttribute
LayoutKind



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「FieldOffsetAttribute」の関連用語

FieldOffsetAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



FieldOffsetAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS