# OpcValueCollection&lt;T&gt; Members

> Reference: Represents a generic collection of OpcValue instances.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcValueCollection&lt;T&gt;</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>

Inherits members from [Collection&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1).

## Constructors

### OpcValueCollection

<span class="api-meta">2 overloads</span>

| Overload | Description |
|---|---|
| [OpcValueCollection()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/members#opcvaluecollection-noparams) | Initializes a new instance of the [OpcValueCollection&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/) class. |
| [OpcValueCollection(IList&lt;T&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/members#opcvaluecollection-system-collections-generic-ilist-of-t0) | Initializes a new instance of the [OpcValueCollection&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/) class as a wrapper for the specified `list`. |

#### OpcValueCollection()

Initializes a new instance of the [OpcValueCollection&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/) class.

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

```csharp
public OpcValueCollection()
```

</div>

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

```vbnet
Public Sub New()
```

</div>

#### OpcValueCollection(IList&lt;T&gt;)

Initializes a new instance of the [OpcValueCollection&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvaluecollection-1/) class as a wrapper for the specified `list`.

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

```csharp
public OpcValueCollection(IList<T> list)
```

</div>

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

```vbnet
Public Sub New(list As IList(Of T))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `list` | [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1)&lt;T&gt; | The [IList&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1) of [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) instances to wrap. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `list` is a null reference (Nothing in Visual Basic). |

## Methods

### ClearItems

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

Removes all values from the collection.

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

```csharp
protected override void ClearItems()
```

</div>

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

```vbnet
Protected Overrides Sub ClearItems()
```

</div>

**Overrides**

[ClearItems()](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1.clearitems)

### InsertItem

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

Inserts the `item` into the collection at the `index` specified.

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

```csharp
protected override void InsertItem(int index, T item)
```

</div>

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

```vbnet
Protected Overrides Sub InsertItem(index As Integer, item As T)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `index` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The zero-based index at which the `item` is to be inserted. |
| `item` | T | The value to insert. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `index` is less than zero or greater than the number of values in the collection. |

**Overrides**

[InsertItem(int, T)](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1.insertitem)

### RemoveItem

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

Removes the value at the `index` specified from the collection.

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

```csharp
protected override void RemoveItem(int index)
```

</div>

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

```vbnet
Protected Overrides Sub RemoveItem(index As Integer)
```

</div>

**Parameters**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `index` is less than zero or not less than the number of values in the collection. |

**Overrides**

[RemoveItem(int)](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1.removeitem)

### SetItem

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

Replaces the value at the `index` specified with the `item`.

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

```csharp
protected override void SetItem(int index, T item)
```

</div>

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

```vbnet
Protected Overrides Sub SetItem(index As Integer, item As T)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `index` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The zero-based index of the value to replace. |
| `item` | T | The value to set at the `index`. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `index` is less than zero or not less than the number of values in the collection. |

**Overrides**

[SetItem(int, T)](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1.setitem)
