# OpcNamespaceCollection Members

> Reference: Represents a collection of OpcNamespace instances.

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

## Constructors

### OpcNamespaceCollection

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

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

#### OpcNamespaceCollection()

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

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

```csharp
public OpcNamespaceCollection()
```

</div>

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

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

</div>

#### OpcNamespaceCollection(IList&lt;OpcNamespace&gt;)

Initializes a new instance of the [OpcNamespaceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/) class as a wrapper for the specified `list`.

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

```csharp
public OpcNamespaceCollection(IList<OpcNamespace> list)
```

</div>

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

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

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `list` | [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1)&lt;[OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/)&gt; | The [IList&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1) of [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) values 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 · since v2.12</span>

Removes all elements 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)

### Dispose

<span class="api-meta">2 overloads · since v2.12</span>

| Overload | Description |
|---|---|
| [Dispose()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/members#dispose-noparams)<span class="api-meta">since v2.12</span> | Releases all resources used by the [OpcNamespaceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/). |
| [Dispose(bool)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/members#dispose-system-boolean)<span class="api-meta">protected · virtual · since v2.12</span> | Releases the unmanaged resources used by the [OpcNamespaceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/) and optionally releases the managed resources. |

#### Dispose()

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

Releases all resources used by the [OpcNamespaceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/).

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

```csharp
public void Dispose()
```

</div>

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

```vbnet
Public Sub Dispose()
```

</div>

**Implements**

[Dispose()](https://learn.microsoft.com/dotnet/api/system.idisposable.dispose)

#### Dispose(bool)

<span class="api-meta">protected · virtual · since v2.12</span>

Releases the unmanaged resources used by the [OpcNamespaceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespacecollection/) and optionally releases the managed resources.

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

```csharp
protected virtual void Dispose(bool disposing)
```

</div>

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

```vbnet
Protected Overridable Sub Dispose(disposing As Boolean)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `disposing` | [Boolean](https://learn.microsoft.com/dotnet/api/system.boolean) | The value true to release both managed and unmanaged resources; otherwise the value false to release only unmanaged resources. |

### InsertItem

<span class="api-meta">protected · override · since v2.12</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, OpcNamespace item)
```

</div>

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

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

</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` | [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) | The [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) 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 elements in the collection. |

**Overrides**

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

### RemoveItem

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

Removes the element 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 element to remove. |

**Exceptions**

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

**Overrides**

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

### Resolve

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

Resolves another namespace using the information in the `source` specified.

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

```csharp
public OpcNamespace Resolve(OpcNamespace source)
```

</div>

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

```vbnet
Public Function Resolve(source As OpcNamespace) As OpcNamespace
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `source` | [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) | The [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) its [Index](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/members#index) (if specified) or its [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/members#value) (if specified) is used to determine the according namespace known. |

**Returns**

[OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/)

The [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) instance known using the index or value of the `source` specified; otherwise a null reference (Nothing in Visual Basic).

**Exceptions**

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

**Implements**

[Resolve](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnamespaceresolver/members#resolve)

### ResolveIndex

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

Resolves the unique identifier of the namespace specified by the `namespaceValue`.

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

```csharp
public int ResolveIndex(string namespaceValue)
```

</div>

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

```vbnet
Public Function ResolveIndex(namespaceValue As String) As Integer
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `namespaceValue` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The string representation of the namespace its unique numeric identifier is to be resolved. |

**Returns**

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

The unique numeric identifier of the namespace which could be looked up using the `namespaceValue` specified; otherwise -1 if there is no known namespace which matches the `namespaceValue` specified.

**Implements**

[ResolveIndex](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnamespaceresolver/members#resolveindex)

### ResolveValue

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

Resolves the [string](https://learn.microsoft.com/dotnet/api/system.string)-based representation of the namespace which can be identified using the `namespaceIndex` specified.

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

```csharp
public string ResolveValue(int namespaceIndex)
```

</div>

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

```vbnet
Public Function ResolveValue(namespaceIndex As Integer) As String
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The numeric unique identifier of the namespace its [string](https://learn.microsoft.com/dotnet/api/system.string)-based representation is to be resolved. |

**Returns**

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

The [string](https://learn.microsoft.com/dotnet/api/system.string)-based representation of the namespace which could be looked up using the `namespaceIndex` specified; otherwise a null reference (Nothing in Visual Basic).

**Implements**

[ResolveValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnamespaceresolver/members#resolvevalue)

### SetItem

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

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

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

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

</div>

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

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

</div>

**Parameters**

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

**Exceptions**

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

**Overrides**

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