VBFixedArrayAttribute クラス

定義

構造体または非ローカル変数の配列を固定長配列として扱う必要があることを示します。

public ref class VBFixedArrayAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple=false, Inherited=false)]
public sealed class VBFixedArrayAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple=false, Inherited=false)>]
type VBFixedArrayAttribute = class
    inherit Attribute
Public NotInheritable Class VBFixedArrayAttribute
Inherits Attribute
継承
VBFixedArrayAttribute
属性

Structure Book
    <VBFixedArray(4)> Public Chapter() As Integer
End Structure

Sub WriteData()
    Dim FileNum As Integer = FreeFile()
    Dim MyBook As Book
    ReDim MyBook.Chapter(4)
    ' Add code to populate the array.
    MyBook.Chapter(0) = 1
    MyBook.Chapter(1) = 2
    MyBook.Chapter(2) = 3
    MyBook.Chapter(3) = 4
    MyBook.Chapter(4) = 5
    ' Write the array to a file.
    FileOpen(FileNum, "C:\testfile", OpenMode.Binary,
             OpenAccess.Write, OpenShare.Default)
    FilePut(FileNum, MyBook) ' Write data.
    FileClose(FileNum)
End Sub

Note

VBFixedArrayAttributeは情報であり、ストレージは割り当てられません。 この属性の目的は、 VBFixedArrayAttributeを認識するメソッドまたは API 呼び出しによって構造体内の配列と非ローカル変数がどのように使用されるかを変更することです。 この属性は可変長配列を固定配列に変換せず、 Dim または ReDim ステートメントを使用して配列ストレージを割り当てる必要があることに注意してください。

注釈

Visual Basic配列は、既定では可変長です。 この属性は、FileGetFilePut、固定長配列を必要とする API 呼び出しなど、Visual Basicファイルの入出力関数を使用する場合に便利です。

コンストラクター

名前 説明
VBFixedArrayAttribute(Int32, Int32)

Bounds プロパティの値を初期化します。

VBFixedArrayAttribute(Int32)

Bounds プロパティの値を初期化します。

プロパティ

名前 説明
Bounds

配列の境界を返します。

Length

配列のサイズを返します。

TypeId

派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。

(継承元 Attribute)

メソッド

名前 説明
Equals(Object)

このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

名前 説明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

インターフェイスの型情報を取得するために使用できるオブジェクトの型情報を取得します。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されるプロパティとメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください