Click or drag to resize

ASizeT Function (Array OfT, UInt32)

Grow or shrink an array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION ASize<T>(
	aTarget AS ARRAY OF<T>,
	dwLength AS DWORD
)
WHERE T : NEW()
 AS ARRAY OF<T>
View Source

Parameters

aTarget
Type: Array OfT
The array to grow or shrink.
dwLength
Type: UInt32
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