# SalArray

Namespace: **PPJ.Runtime**

Assembly: **PPJ.Runtime.49** (4.9.0.0)

Dynamic array class. This class replicates SAL dynamic arrays. It must be declared as an inner class of the class that should be used as the type of the elements of the dynamic array.

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

```csharp
public class SalArray : IList, ICollection, IEnumerable, IXmlSerializable, ISalType
```

{% endtab %}

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

```visual-basic
Public Class SalArray
    Inherits IList
    Implements ICollection, IEnumerable, IXmlSerializable, ISalType
```

{% endtab %}
{% endtabs %}

## Properties

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Count

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Number of array elements

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Dimensions

[SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md): Returns the number of dimensions.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)IsDynamic

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns true if the array is dynamic.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)IsEmpty

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns true if the array is empty.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)IsMultidimensional

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns true if the array is an MD array.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)IsSynchronized

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): IsSynchronized

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

[Object](https://docs.microsoft.com/en-us/dotnet/api/system.object): Get/Set functions used to access the array. The implementation classes will call these methods from their indexers.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Length

[SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md): Returns the total number of items in the array. For MD arrays returns the number of items in the first dimension.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SyncRoot

[Object](https://docs.microsoft.com/en-us/dotnet/api/system.object): SynchRoot

## Methods

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Add(value)

Appends one item to the array.

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **value** | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) |             |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)AddRange(collection)

Appends the collection of items to the array.

| Parameter      | Type                                                                                      | Description |
| -------------- | ----------------------------------------------------------------------------------------- | ----------- |
| **collection** | [IEnumerable](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Avg()

Returns the average value of all the numbers in an array.

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md). nAvg

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Clear()

Clears a dynamic array

### ![](/files/dBIrS7XBDGmrzmTRbSI6)CopyTo(array, index)

CopyTo

| Parameter | Type                                                              | Description |
| --------- | ----------------------------------------------------------------- | ----------- |
| **array** | [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) |             |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)DimCount()

Returns the number of dimensions in an array.

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)DimCount(nDim)

| Parameter | Type                                                        | Description |
| --------- | ----------------------------------------------------------- | ----------- |
| **nDim**  | [SalNumber&](/ppj.runtime.49/types/ppj.runtime.salarray.md) |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Fill(value, count)

Fills an array with the specified value.

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **value** | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) |             |
| **count** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)   |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Find(value, start)

Finds the value in the array. This is allowed only for single-dimension arrays.

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **value** | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) |             |
| **start** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)   |             |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](/files/69uzLyEV3ANF4GK6pznb)FromNativeArray(array)

Creates a SalArray from a native array. The type is inferred from the array.

| Parameter | Type                                                              | Description                            |
| --------- | ----------------------------------------------------------------- | -------------------------------------- |
| **array** | [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array) | Native array to convert to a SalArray. |

**Returns:** [SalArray](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/69uzLyEV3ANF4GK6pznb)FromNativeArray(array, dbType)

Creates a SalArray from a native array of the specified *dbType* .

| Parameter  | Type                                                                     | Description                                  |
| ---------- | ------------------------------------------------------------------------ | -------------------------------------------- |
| **array**  | [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array)        | Native array to convert to a SalArray.       |
| **dbType** | [DbType](https://docs.microsoft.com/en-us/dotnet/api/system.data.dbtype) | Type of the elements in the source *array* . |

**Returns:** [SalArray](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetArray(capacity)

Returns the wrapped native array and ensures that the requested element is created for dynamic arrays.

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

**Returns:** [Array](https://docs.microsoft.com/en-us/dotnet/api/system.array).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetElementType()

Returns the type of the array elements

**Returns:** [Type](https://docs.microsoft.com/en-us/dotnet/api/system.type).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetEnumerator()

IEnumerator implementation to support the foreach statement.

**Returns:** [IEnumerator](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerator).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetLength(dim)

Returns the number of items in the array

| Parameter | Type                                                              | Description          |
| --------- | ----------------------------------------------------------------- | -------------------- |
| **dim**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | dimension, first = 1 |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetLowerBound(dim)

Returns the lower bound of the array.

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

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetLowerBound(dim, lbound)

| Parameter  | Type                                                              | Description |
| ---------- | ----------------------------------------------------------------- | ----------- |
| **dim**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **lbound** | [SalNumber&](/ppj.runtime.49/types/ppj.runtime.salarray.md)       |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetUpperBound(dim)

Returns the upper bound of an array.

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

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)GetUpperBound(dim, ubound)

| Parameter  | Type                                                              | Description |
| ---------- | ----------------------------------------------------------------- | ----------- |
| **dim**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **ubound** | [SalNumber&](/ppj.runtime.49/types/ppj.runtime.salarray.md)       |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Insert(index)

Inserts an item at the position. This is allowed only for single-dimension arrays.

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)MakeDynamic()

Makes the array dynamic.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Max()

Returns the maximum value in an array of numbers.

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Min()

Returns the minimum value in an array of numbers.

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)QueryBounds(min, max)

| Parameter | Type                                                        | Description |
| --------- | ----------------------------------------------------------- | ----------- |
| **min**   | [SalNumber&](/ppj.runtime.49/types/ppj.runtime.salarray.md) |             |
| **max**   | [SalNumber&](/ppj.runtime.49/types/ppj.runtime.salarray.md) |             |

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Remove(index)

Removes the item at the index. This is allowed only for single-dimension arrays.

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Reset()

Resets a dynamic array

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SetBounds(lower, upper)

Sets the lower and upper bound of an array for the first dimension only. NOTE: In SAL this function was named SalSetArrayBounds().

| Parameter | Type                                                              | Description |
| --------- | ----------------------------------------------------------------- | ----------- |
| **lower** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **upper** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SetLength(dim, length)

Changes the number of items in the array

| Parameter  | Type                                                              | Description          |
| ---------- | ----------------------------------------------------------------- | -------------------- |
| **dim**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | dimension, first = 1 |
| **length** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |                      |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SetLowerBound(dim, bound)

Changes the lower bound of the array

| Parameter | Type                                                              | Description |
| --------- | ----------------------------------------------------------------- | ----------- |
| **dim**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **bound** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SetUpperBound(dim, bound)

Sets the upper bound of an array. The first dimension is 1.

| Parameter | Type                                                              | Description |
| --------- | ----------------------------------------------------------------- | ----------- |
| **dim**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **bound** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Sort(index, count, comparer)

Sorts the items in the array.

| Parameter    | Type                                                                                  | Description |
| ------------ | ------------------------------------------------------------------------------------- | ----------- |
| **index**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                     |             |
| **count**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                     |             |
| **comparer** | [IComparer](https://docs.microsoft.com/en-us/dotnet/api/system.collections.icomparer) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Sort(comparer)

Sorts the items in the array.

| Parameter    | Type                                                                                  | Description |
| ------------ | ------------------------------------------------------------------------------------- | ----------- |
| **comparer** | [IComparer](https://docs.microsoft.com/en-us/dotnet/api/system.collections.icomparer) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Sum()

Returns the sum of the elements in an array of numbers.

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.salarray.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)ToNativeArray()

Converts to an array of native types.

**Returns:** [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object).

## Inherited By

| Name                                                          | Description                                                                                                                                                      |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [SalArray\<T>](/ppj.runtime.49/types/ppj.runtime.salarray.md) | 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. |

## Implements

| Name                                                      | Description                          |
| --------------------------------------------------------- | ------------------------------------ |
| [ISalType](/ppj.runtime.49/types/ppj.runtime.salarray.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://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.salarray.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.
