# OpcClient.RegisterNode Method

> Reference: Registers a node for optimized node access using the command specified.

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

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

| Overload | Description |
|---|---|
| [RegisterNode(OpcRegisterNode)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/registernode#registernode-opc-uafx-opcregisternode)<span class="api-meta">since v2.8</span> | Registers a node for optimized node access using the `command` specified. |
| [RegisterNode(OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/registernode#registernode-opc-uafx-opcnodeid)<span class="api-meta">since v2.8</span> | Registers a node for optimized node access using the identifier of the node. |

**Known results:** [BadNodeIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeidinvalid)

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [ObjectDisposedException](https://learn.microsoft.com/dotnet/api/system.objectdisposedexception) | The object has been disposed of. |

## RegisterNode(OpcRegisterNode)

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

Registers a node for optimized node access using the `command` specified.

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

```csharp
public OpcNodeId RegisterNode(OpcRegisterNode command)
```

</div>

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

```vbnet
Public Function RegisterNode(command As OpcRegisterNode) As OpcNodeId
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `command` | [OpcRegisterNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcregisternode/) | The [OpcRegisterNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcregisternode/) instance to process. |

**Returns**

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

An instance of the [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) class which is to be used for subsequent optimized node access.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `command` is a null reference (Nothing in Visual Basic). |
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | The register node service is currently not supported, especially using the `command` specified. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The service execution failed upon different circumstances; for more details see exception details. The following issues can lead to that exception: [BadNothingToDo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnothingtodo) and [BadTooManyMatches](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtoomanymatches). |

**Remarks**

Servers completely reject register nodes requests if any of the node identifiers passed are structurally invalid.

## RegisterNode(OpcNodeId)

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

Registers a node for optimized node access using the identifier of the node. A once registered node needs to be unregistered as soon as the optimized node access is not longer required. This assures that the server can release unused resources reserved for the optimized node access.

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

```csharp
public OpcNodeId RegisterNode(OpcNodeId nodeId)
```

</div>

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

```vbnet
Public Function RegisterNode(nodeId As OpcNodeId) As OpcNodeId
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `nodeId` | [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) | The [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) through that the node to register can be identified. |

**Returns**

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

An instance of the [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) class which is to be used for subsequent optimized node access. Use this identifier to release unused resources associated with the optimized node access using [UnregisterNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/unregisternode#unregisternode-opc-uafx-opcnodeid) as soon as the optimized node access is not longer required.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` is equals [Null](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/members#null). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `nodeId` is a null reference (Nothing in Visual Basic). |
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | The register node service is currently not supported, especially using the parameters specified. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The service execution failed upon different circumstances; for more details see exception details. The following issues can lead to that exception: [BadNothingToDo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnothingtodo) and [BadTooManyOperations](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtoomanyoperations). |

**Remarks**

Servers completely reject register nodes requests if any of the node identifiers passed are structurally invalid.
