# OpcAddNodeCollection Members

> Reference: Defines a collection for OpcAddNode instances.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcAddNodeCollection</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;OpcAddNode&gt;](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1).

## Constructors

### OpcAddNodeCollection

Initializes a new instance of the [OpcAddNodeCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnodecollection/) class.

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

```csharp
public OpcAddNodeCollection()
```

</div>

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

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

</div>

## Methods

### InsertItem

<span class="api-meta">protected · override · since v2.9</span>

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

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

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

</div>

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

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

</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` | [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) | The [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) to insert. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The collection accepts only commands of certain node categories (e.g. the [Children](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddobjecttypenode/members#children)) and the [Category](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/members#category) of the `item` is not one of them. |
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `index` is less than zero or greater than the number of commands in the collection. |

**Overrides**

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

### SetItem

<span class="api-meta">protected · override · since v2.9</span>

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

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

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

</div>

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

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

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `index` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The zero-based index of the command to replace. |
| `item` | [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) | The [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) to set at the `index`. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The collection accepts only commands of certain node categories (e.g. the [Children](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddobjecttypenode/members#children)) and the [Category](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/members#category) of the `item` is not one of them. |
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The `index` is less than zero or not less than the number of commands in the collection. |

**Overrides**

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