ArraySwapT Function (Array OfT, DWord, T) | ![X#](../icons/logo100.jpg) |
Replace an array element with a new value and return the old value.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION ArraySwap<T>(
aTarget AS ARRAY OF<T>,
dwElement AS DWORD,
uNewValue AS T
)
AS T
public static T ArraySwap<T>(
Array Of<T> aTarget,
uint dwElement,
T uNewValue
)
Request Example
View SourceParameters
- aTarget
- Type: Array OfT
The array whose element will be replaced with a new value. - dwElement
- Type: DWord
The number of the element to be replaced. - uNewValue
- Type: T
The new value.
Type Parameters
- T
- The type of the array elements
Return Value
Type:
T
The value that was replaced by
uNewValue.
Remarks
ArraySwap() replaces the element specified with a new value.
Examples
This example swaps the second and third elements of an array:
1FUNCTION Start()
2 LOCAL aList[4]
3 ArrayPut(aList, 1, "First")
4 ArrayPut(aList, 2, "Second")
5 ArrayPut(aList, 3, "Third")
6 ArrayPut(aList, 4, "Fourth")
7 aList[3] := ArraySwap(aList, 2, aList[3])
See Also