# OpcArrayDimensions Members

> Reference: Provides the lengths of array dimensions.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcArrayDimensions</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

## Constructors

### OpcArrayDimensions

Initializes a new instance of the [OpcArrayDimensions](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/) class with the `lengths` of dimensions to represent.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcArrayDimensions(params uint[] lengths)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(ParamArray lengths As UInteger())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `lengths` | params [UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)[] | An array its items representing the lengths of the dimensions to represent. |

## Properties

### Length

Gets the total number of elements in all the dimensions.

<div class="api-signature" data-lang="csharp">

```csharp
public long Length { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Length As Long
```

</div>

**Property value**

[Int64](https://learn.microsoft.com/dotnet/api/system.int64)

The total number of elements in all the dimensions; zero if there are no elements in the array.

### Rank

Gets the rank (number of dimensions). For example, a one-dimensional array returns 1, a two-dimensional array returns 2, and so on.

<div class="api-signature" data-lang="csharp">

```csharp
public int Rank { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Rank As Integer
```

</div>

**Property value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

The rank (number of dimensions) or zero if there are no dimensions defined.

## Methods

### CreateArray

<span class="api-meta">since v2.22</span>

Creates an [Array](https://learn.microsoft.com/dotnet/api/system.array) of the specified `elementType` and dimensions represented.

<div class="api-signature" data-lang="csharp">

```csharp
public Array CreateArray(Type elementType)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function CreateArray(elementType As Type) As Array
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `elementType` | [Type](https://learn.microsoft.com/dotnet/api/system.type) | The [Type](https://learn.microsoft.com/dotnet/api/system.type) of the [Array](https://learn.microsoft.com/dotnet/api/system.array) to create. |

**Returns**

[Array](https://learn.microsoft.com/dotnet/api/system.array)

A new [Array](https://learn.microsoft.com/dotnet/api/system.array) of the specified [Type](https://learn.microsoft.com/dotnet/api/system.type) with the length for each dimension represented, using zero-based indexing.

**Exceptions**

| Exception | Condition |
|---|---|
| [NotSupportedException](https://learn.microsoft.com/dotnet/api/system.notsupportedexception) | The `elementType` is not supported. For example, [void](https://learn.microsoft.com/dotnet/api/system.void) is not supported or `elementType` is an open generic type. |

### GetEnumerator

Returns an enumerator that iterates through the dimensions.

<div class="api-signature" data-lang="csharp">

```csharp
public IEnumerator<uint> GetEnumerator()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function GetEnumerator() As IEnumerator(Of UInteger)
```

</div>

**Returns**

[IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1)&lt;[UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)&gt;

An enumerator that can be used to iterate through the dimensions.

**Implements**

[GetEnumerator()](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1.getenumerator)

### GetLength

Gets a 32-bit integer that represents the number of elements in the specified dimension of the array.

<div class="api-signature" data-lang="csharp">

```csharp
public long GetLength(int dimension)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function GetLength(dimension As Integer) As Long
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `dimension` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | A zero-based dimension of the array whose length needs to be determined. |

**Returns**

[Int64](https://learn.microsoft.com/dotnet/api/system.int64)

A 32-bit integer that represents the number of elements in the specified dimension of the array.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `dimension` is less than zero or equals to or greater than [Rank](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/members#rank). |

### GetLowerBound

Gets the index of the first element of the specified dimension in the array.

<div class="api-signature" data-lang="csharp">

```csharp
public long GetLowerBound(int dimension)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function GetLowerBound(dimension As Integer) As Long
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `dimension` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | A zero-based dimension of the array whose starting index needs to be determined. |

**Returns**

[Int64](https://learn.microsoft.com/dotnet/api/system.int64)

The index of the first element of the specified dimension in the array.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `dimension` is less than zero or equals to or greater than [Rank](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/members#rank). |

### GetUpperBound

Gets the index of the last element of the specified dimension in the array.

<div class="api-signature" data-lang="csharp">

```csharp
public long GetUpperBound(int dimension)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function GetUpperBound(dimension As Integer) As Long
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `dimension` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | A zero-based dimension of the array whose upper bound needs to be determined. |

**Returns**

[Int64](https://learn.microsoft.com/dotnet/api/system.int64)

The index of the last element of the specified dimension in the array, or -1 if the specified dimension is empty.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `dimension` is less than zero or equals to or greater than [Rank](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/members#rank). |

### ToString

<span class="api-meta">override</span>

Returns a string that represents the [OpcArrayDimensions](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/).

<div class="api-signature" data-lang="csharp">

```csharp
public override string ToString()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Function ToString() As String
```

</div>

**Returns**

[String](https://learn.microsoft.com/dotnet/api/system.string)

A [string](https://learn.microsoft.com/dotnet/api/system.string) representing the [OpcArrayDimensions](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcarraydimensions/).

**Overrides**

[ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Indexers

### Item

Gets the length of the `dimension` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public uint this[int dimension] { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Default Property this[](dimension As Integer) As UInteger
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `dimension` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The zero-based dimension of the length to get. |

**Property value**

[UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)

The length of the specified `dimension`.

**Implements**

[this\[int\]](https://learn.microsoft.com/dotnet/api/system.int32)
