Skip to main content

SalArray<T>

Namespace: PPJ.Runtime

Assembly: PPJ.Runtime.49 (4.9.0.0)

Dynamic array generic class. This class replicates SAL dynamic arrays. It can be used without being declared as an inner class by using the new generics syntax.

public class SalArray<T> : SalArray, IEnumerable<T>, IList<T>, ICollection<T>

Parameters

NameDescription
T

Constructors

Instance memberSalArray()

Constructs a new dynamic array.

Instance memberSalArray(lengths)

Constructs a new array.

NameTypeDescription
lengthsInt32[]

Instance memberSalArray(bounds)

Constructs a new array. Example: new SalArray("2:3")

NameTypeDescription
boundsString[]String definition of the array dimensions. It can specify lower bounds as "2:3".

Properties

Instance memberItem(index)

T: Returns or sets the item at the specified index.

Instance memberItem(indices)

T: Returns or sets the item at the specified coordinates in a multidimensional array.

Instance memberItems

T[]: Returns the internal array.

Methods

Instance memberAdd(item)

Adds an object to the end of the array.

ParameterTypeDescription
itemTThe object to be added to the end of the array. The value can be null for reference types.

Instance memberAddRange(collection)

Adds the elements of the specified collection to the end of the array.

ParameterTypeDescription
collectionIEnumerable<T>The collection whose elements should be added to the end of the array. The collection itself cannot be null, but it can contain elements that are null, if type collection is a reference type.

Throws:

Instance memberContains(item)

Determines whether an element is in the array.

ParameterTypeDescription
itemTThe object to locate in the array. The value can be null for reference types.

Returns: Boolean. true if item is found in the array; otherwise, false.

Instance memberCopyTo(array)

Copies the entire array to a compatible one-dimensional array, starting at the beginning of the target array.

ParameterTypeDescription
arrayT[]The one-dimensional Array that is the destination of the elements copied. The Array must have zero-based indexing.

Throws:

Instance memberCopyTo(array, arrayIndex)

Copies the entire array to a compatible one-dimensional array, starting at the specified index of the target array.

ParameterTypeDescription
arrayT[]The one-dimensional Array that is the destination of the elements copied. The Array must have zero-based indexing.
arrayIndexInt32The zero-based index in array at which copying begins.

Throws:

Instance memberGetArray()

Returns the internal array.

Returns: T[].

Instance memberGetArray(minLength)

Returns the internal array resized to guarantee the specified minimum unmber of items.

ParameterTypeDescription
minLengthInt32The minimum number of items that should be ensured in the array.

Returns: T[].

Instance memberGetArray(minLength1, minLength2)

Returns the internal multidimensional array resized to guarantee the specified number of items in each dimension.

ParameterTypeDescription
minLength1Int32The minimum number of items for the first dimension.
minLength2Int32The minimum number of items for the second dimension.

Returns: T[,].

Instance memberGetArray(minLength1, minLength2, minLength3)

Returns the internal multidimensional array resized to guarantee the specified number of items in each dimension.

ParameterTypeDescription
minLength1Int32The minimum number of items for the first dimension.
minLength2Int32The minimum number of items for the second dimension.
minLength3Int32The minimum number of items for the third dimension.

Returns: T[,,].

Instance memberGetArray(minLength1, minLength2, minLength3, minLength4)

Returns the internal multidimensional array resized to guarantee the specified number of items in each dimension.

ParameterTypeDescription
minLength1Int32The minimum number of items for the first dimension.
minLength2Int32The minimum number of items for the second dimension.
minLength3Int32The minimum number of items for the third dimension.
minLength4Int32The minimum number of items for the fourth dimension.

Returns: T[,,,].

Instance memberIndexOf(item)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire array.

ParameterTypeDescription
itemTThe object to locate in the array. The value can be null for reference types.

Returns: Int32. The zero-based index of the first occurrence of item , if found; otherwise, –1.

Instance memberIndexOf(item, index)

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the array.

ParameterTypeDescription
itemTThe object to locate in the array. The value can be null for reference types.
indexInt32The zero-based starting index of the search. 0 (zero) is valid in an empty list.

Returns: Int32. The zero-based index of the first occurrence of item within the range of elements, if found; otherwise, –1.

Throws:

Instance memberInsert(index, item)

Inserts an element into the array at the specified index.

ParameterTypeDescription
indexInt32The zero-based index at which item should be inserted.
itemTThe object to insert. The value can be null for reference types.

Throws:

Instance memberInsertRange(index, collection)

Inserts the elements of a collection into the array at the specified index.

ParameterTypeDescription
indexInt32The zero-based index at which the new elements should be inserted.
collectionIEnumerable<T>The collection whose elements should be inserted. The collection itself cannot be null, but it can contain elements that are null, if type collection is a reference type.

Throws:

Instance memberRemove(item)

Removes the first occurrence of a specific object from the array.

ParameterTypeDescription
itemTThe object to remove from the array. The value can be null for reference types.

Returns: Boolean. true if item is successfully removed; otherwise, false. This method also returns false if item was not found.

Instance memberRemoveAt(index)

Removes the element at the specified index.

ParameterTypeDescription
indexInt32The zero-based index of the element to remove.

Throws:

Instance memberSort(comparison)

Sorts the items in the array using the specified comparison expression.

ParameterTypeDescription
comparisonComparison<T>The comparison expression.

Implements

NameDescription
ISalTypeCommon base interface for Sal types.