ASize Function (Array, DWord) | |
Grow or shrink an array.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION ASize(
aTarget AS ARRAY,
dwLength AS DWORD
) AS ARRAY
public static Array ASize(
Array aTarget,
uint dwLength
)
Request Example
View SourceParameters
- aTarget
- Type: Array
The array to grow or shrink. - dwLength
- Type: DWord
The new size of the array.
Return Value
Type:
Array
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:
1LOCAL aArray AS ARRAY
2aArray := {1}
3ASize(aArray, 3)
4ASize(aArray, 1)
See Also