ASizeT Function (Array OfT, DWord) | |
Grow or shrink an array.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION ASize<T>(
aTarget AS ARRAY OF<T>,
dwLength AS DWORD
)
AS ARRAY OF<T>
public static Array Of<T> ASize<T>(
Array Of<T> aTarget,
uint dwLength
)
Request Example
View SourceParameters
- 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:
1LOCAL aArray AS ARRAY
2aArray := {1}
3ASize(aArray, 3)
4ASize(aArray, 1)
See Also