Method

Operator_Redim


Description

The Redim statement can be overloaded by a class. To use it, implement Operator_Redim in your class.It makes the Redim statement available for objects that were not declared as arrays.

Important

This is not currently supported for Android.

Sample code

Class OneBasedArray
  Sub Constructor(bounds As Integer = 0)
    Redim mArray(bounds - 1)
  End Sub

  Function Count() As Integer
    Return mArray.Ubound + 1
  End Function

  Sub Operator_Redim(newSize As Integer)
    Redim mArray(newSize - 1)
  End Sub

  Function Operator_Subscript(index As Integer) As Variant
    Return mArray(index - 1)
  End Function

  Sub Operator_Subscript(index As Integer, Assigns v As Variant)
    mArray(index - 1) = v
  End Sub

  Private mArray() As Variant
End Class

Compatibility

All project types on all supported operating systems.