# SalArray\<T>

Namespace: **PPJ.Runtime**

Assembly: **PPJ.Web.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.

{% tabs %}
{% tab title="C#" %}

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

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SalArray(Of T)
    Inherits SalArray
    Implements IEnumerable(Of T), IList(Of T), ICollection(Of T)
```

{% endtab %}
{% endtabs %}

## Parameters

| Name  | Description |
| ----- | ----------- |
| **T** |             |

## Constructors

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)SalArray()

Constructs a new dynamic array.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)SalArray(lengths)

Constructs a new array.

| Name        | Type                                                                  | Description |
| ----------- | --------------------------------------------------------------------- | ----------- |
| **lengths** | [Int32\[\]](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)SalArray(bounds)

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

| Name       | Type                                                                    | Description                                                                      |
| ---------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **bounds** | [String\[\]](https://docs.microsoft.com/en-us/dotnet/api/system.string) | String definition of the array dimensions. It can specify lower bounds as "2:3". |

## Properties

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Item(index)

[T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than): Returns or sets the item at the specified index.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Item(indices)

[T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than): Returns or sets the item at the specified coordinates in a multidimensional array.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Items

[T\[\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than): Returns the internal array.

## Methods

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Add(item)

Adds an object to the end of the array.

| Parameter | Type                                                                                                | Description                                                                                |
| --------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to be added to the end of the array. The value can be null for reference types. |

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)AddRange(collection)

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

| Parameter      | Type                                                                                                  | Description                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **collection** | [IEnumerable\<T>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable) | 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:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *collection* is null.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Contains(item)

Determines whether an element is in the array.

| Parameter | Type                                                                                                | Description                                                                   |
| --------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to locate in the array. The value can be null for reference types. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if *item* is found in the array; otherwise, false.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)CopyTo(array)

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

| Parameter | Type                                                                                                    | Description                                                                                                                                                                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **array** | [T\[\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The one-dimensional [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) that is the destination of the elements copied. The [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) must have zero-based indexing. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *array* is null.
* [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception) The number of elements in the source array is greater than the number of elements that the destination *array* can contain.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)CopyTo(array, arrayIndex)

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

| Parameter      | Type                                                                                                    | Description                                                                                                                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **array**      | [T\[\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The one-dimensional [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) that is the destination of the elements copied. The [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) must have zero-based indexing. |
| **arrayIndex** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                                       | The zero-based index in *array* at which copying begins.                                                                                                                                                                                   |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *array* is null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *arrayIndex* is less than 0.
* [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception) The number of elements in the array is greater than the available space from *arrayIndex* to the end of the destination *array* .

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)GetArray()

Returns the internal array.

**Returns:** [T\[\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than).

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)GetArray(minLength)

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

| Parameter     | Type                                                              | Description                                                      |
| ------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------- |
| **minLength** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items that should be ensured in the array. |

**Returns:** [T\[\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than).

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)GetArray(minLength1, minLength2)

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

| Parameter      | Type                                                              | Description                                           |
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **minLength1** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the first dimension.  |
| **minLength2** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the second dimension. |

**Returns:** [T\[,\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than).

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)GetArray(minLength1, minLength2, minLength3)

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

| Parameter      | Type                                                              | Description                                           |
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **minLength1** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the first dimension.  |
| **minLength2** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the second dimension. |
| **minLength3** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the third dimension.  |

**Returns:** [T\[,,\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than).

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)GetArray(minLength1, minLength2, minLength3, minLength4)

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

| Parameter      | Type                                                              | Description                                           |
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **minLength1** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the first dimension.  |
| **minLength2** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the second dimension. |
| **minLength3** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the third dimension.  |
| **minLength4** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The minimum number of items for the fourth dimension. |

**Returns:** [T\[,,,\]](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than).

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)IndexOf(item)

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

| Parameter | Type                                                                                                | Description                                                                   |
| --------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to locate in the array. The value can be null for reference types. |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32). The zero-based index of the first occurrence of *item* , if found; otherwise, –1.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)IndexOf(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.

| Parameter | Type                                                                                                | Description                                                                      |
| --------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to locate in the array. The value can be null for reference types.    |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                                   | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32). The zero-based index of the first occurrence of *item* within the range of elements, if found; otherwise, –1.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is outside the range of valid indexes.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Insert(index, item)

Inserts an element into the array at the specified index.

| Parameter | Type                                                                                                | Description                                                      |
| --------- | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                                   | The zero-based index at which *item* should be inserted.         |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to insert. The value can be null for reference types. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0; or *index* is greater than the number of elements in the array.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)InsertRange(index, collection)

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

| Parameter      | Type                                                                                                  | Description                                                                                                                                                                  |
| -------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index**      | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                                     | The zero-based index at which the new elements should be inserted.                                                                                                           |
| **collection** | [IEnumerable\<T>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable) | 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:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *collection* is null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0; or *index* is greater than the number of elements in the array.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Remove(item)

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

| Parameter | Type                                                                                                | Description                                                                     |
| --------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **item**  | [T](https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than) | The object to remove from the array. The value can be null for reference types. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if *item* is successfully removed; otherwise, false. This method also returns false if *item* was not found.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)RemoveAt(index)

Removes the element at the specified index.

| Parameter | Type                                                              | Description                                    |
| --------- | ----------------------------------------------------------------- | ---------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The zero-based index of the element to remove. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0; or *index* is equal to or greater than number of elements in the array.

### ![](https://620403885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrwxBtXkZ9hhQWYdbGhAV%2Fuploads%2FCKg4odMPj9bBKavXG5j4%2Finstance.png?alt=media\&token=2ac4a01b-785e-4197-b802-d5aae2250f90)Sort(comparison)

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

| Parameter      | Type                                                                            | Description                |
| -------------- | ------------------------------------------------------------------------------- | -------------------------- |
| **comparison** | [Comparison\<T>](https://docs.microsoft.com/en-us/dotnet/api/system.comparison) | The comparison expression. |

## Implements

| Name                                                                                        | Description                          |
| ------------------------------------------------------------------------------------------- | ------------------------------------ |
| [ISalType](https://docs.wisej.com/extensions/ppj.web.49/interfaces/ppj.runtime.isaltype.md) | Common base interface for Sal types. |
