Click or drag to resize

ASizeT Function (Array OfT, DWord)

X#
Grow or shrink an array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION ASize<T>(
	aTarget AS ARRAY OF<T>,
	dwLength AS DWORD
)
 AS ARRAY OF<T>
Request Example View Source

Parameters

aTarget
Type: Array OfT
The array to grow or shrink.
dwLength
Type: DWord
The new size of the array.

Type Parameters

T
The type of the array elements

Return Value

Type: Array OfT
A reference to aTarget.
Remarks
ASize() changes the actual length of aTarget.
The array is shortened or lengthened to match the specified length.
If the array is shortened, elements at the end of the array are lost.
If the array is lengthened, new elements are added to the end of the array and assigned NIL. ASize() is similar to AAdd(), which adds a single new element to the end of an array and optionally assigns a new value at the same time. Note that ASize() is different from AIns() and ADel(), which do not actually change the array's length.
Examples
These examples demonstrate adding new elements and deleting existing elements:
X#
1LOCAL aArray AS ARRAY
2aArray := {1}            // aArray is {1}
3ASize(aArray, 3)        // aArray is {1, NIL, NIL}
4ASize(aArray, 1)        // aArray is {1}
See Also