System.Array
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
namespace System public sealed class Array
The Array class is equivalent to [#,#]@class. (See [#,#]@class for more information.) An instance of this class will only be created via the Synergy array syntax. It represents a 1-based array or, on .NET, a 0-based array with .ARRAY 0 declared. (See .ARRAY.) All of the method parameters or return values below that specify an index or dimension are 1-based unless .ARRAY 0 is specified, in which case they are 0-based. See “Variable references” in the Basic language elements topic for more information about array references.
public Length
Returns the total number of elements in all dimensions of the array. (int)
public Rank
Returns the number of dimensions in the array. (int)
public static Clear(array, startindex, count), void
Sets elements in an array to 0, false, or null depending on the element type. When clearing a real array, the array behaves like one pseudo array whose rows are laid end to end. For example, a starting index of 6 in a [5,5] array will start clearing from index [2,1].
The array whose elements are to be cleared. (@Array)
The starting index of the range of elements to clear. (int)
The number of elements to clear. (int)
public static Copy(source, sourceindex, dest, destindex, count), void
Copies a range of elements in one array to another array. When copying between real arrays, each array behaves like one pseudo array whose rows are laid end to end. For example, a starting index of 6 in a [5,5] array will start copying from index [2,1].
The array containing the data to copy. (@Array)
The index in source at which copying begins. (int)
The array that receives the copied data. (@Array)
The index in dest at which storing begins. (int)
The number of elements to copy. (int)
public GetLength(dimension), int
Returns the length of the specified dimension (int).
public GetValue(index), @*
Returns the value at the specified position in a single-dimension array (int).
public static IndexOf(array, value, startindex, count), int
Returns the first 1-based index position of the specified object in a single-dimension array. This method determines equality by calling the Equals() method of the Array element type.
The single-dimension array to search. (@Array)
The object to search for. (@*)
The index at which the search begins. (int)
The number of elements to search. (int)
public static LastIndexOf(array, value, startindex, count), int
Returns the 1-based index of the last occurrence of the specified object in a single-dimension array. This method determines equality by calling the Equals() method of the Array element type.
The single-dimension array to search. (@Array)
The object to search for. (@*)
The index at which the reverse search begins. (int)
The number of elements to search. (int)
public SetValue(value, index), void
Sets the value (@*) at the specified array index (int) in a single-dimension array.
Examples
main record ;Declare real array of alphas of size 3 myarray ,[3]a3 ;Declare dynamic array or string mydynamicarray ,[#]string ;Counter variable to use in FOR loop counter ,int proc ;Open channel to terminal open(1, O, "TT:") ;Real array - populate and display for counter from 1 thru 3 begin ;Add the values A, B, C to the array myarray[counter] = %char(64+counter) ;Writes writes(1, myarray[counter]) end ;Dynamic array - declare with a number of elements then populate and display mydynamicarray = new string[3] for counter from 1 thru 3 begin mydynamicarray[counter] = %char(96+counter) writes(1, mydynamicarray[counter]) end endmain