ArraySwapT Function (Array OfT, DWord, T)
|
|
替换数组元素的值并返回原值。
命名空间:
XSharp.RT
程序集:
XSharp.RT (在 XSharp.RT.dll 中) 版本:2.24 GA
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
查看代码Parameters
- aTarget
- 类型:Array OfT
要替换元素值的数组。 - dwElement
- 类型:DWord
要替换的元素编号。 - uNewValue
- 类型:T
新值。
Type Parameters
- T
- The type of the array elements
Return Value
类型:
T
被
uNewValue 替换的原值。
备注
ArraySwap() 用新值替换指定的数组元素。
Examples
此示例交换数组的第二个和第三个元素:
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