Visual Basic Language Reference  

VBFixedArrayAttribute Class

Used to declare fixed-sized arrays.

<System.AttributeUsage(System.AttributeTargets.Field, _
   Inherited := False, AllowMultiple := False)> _
Public NotInheritable Class VBFixedArrayAttribute
   Inherits System.Attribute

Remarks

Visual Basic .NET arrays are of variable length by default. This attribute is useful when using Visual Basic .NET file input and output functions, such as FileGet and FilePut that require fixed length arrays.

Example

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

Sub WriteData()
   Dim FileNum As Integer = FreeFile()
   Dim MyBook As Book
   '  Add code here to populate the array.
   FileOpen(FileNum, "C:\testfile", OpenMode.Binary, _
            OpenAccess.Write, OpenShare.Default)
   FilePut(FileNum, MyBook) ' Write data.
   FileClose(1)
End Sub

See Also

Attributes | VBFixedArrayAttribute Class Members | XML and SOAP Serialization | VBFixedStringAttribute Class | ComClassAttribute | Declaring Variables for Random File Access | FileGet Function | FilePut Function | FileOpen Function