# 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

### ![](/files/qoQXnPICsjBVNBSqpOj9)SalArray()

Constructs a new dynamic array.

### ![](/files/qoQXnPICsjBVNBSqpOj9)SalArray(lengths)

Constructs a new array.

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

### ![](/files/qoQXnPICsjBVNBSqpOj9)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

### ![](/files/qoQXnPICsjBVNBSqpOj9)Item(index)

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

### ![](/files/qoQXnPICsjBVNBSqpOj9)Item(indices)

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

### ![](/files/qoQXnPICsjBVNBSqpOj9)Items

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

## Methods

### ![](/files/qoQXnPICsjBVNBSqpOj9)Add(item)

Adds an object to the end of the array.

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

### ![](/files/qoQXnPICsjBVNBSqpOj9)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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)Contains(item)

Determines whether an element is in the array.

| Parameter | Type                                                                    | Description                                                                   |
| --------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| **item**  | [T](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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* .

### ![](/files/qoQXnPICsjBVNBSqpOj9)GetArray()

Returns the internal array.

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

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md).

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[,\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md).

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[,,\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md).

### ![](/files/qoQXnPICsjBVNBSqpOj9)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\[,,,\]](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md).

### ![](/files/qoQXnPICsjBVNBSqpOj9)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](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)Remove(item)

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

| Parameter | Type                                                                    | Description                                                                     |
| --------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **item**  | [T](/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md) | 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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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.

### ![](/files/qoQXnPICsjBVNBSqpOj9)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. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://web-api.iceteagroup.com/ppj.web.49/types/ppj.runtime.salarray-less-than-t-greater-than.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
