# OpcAddReference Class

> Reference: Defines a single command of the IOpcAddReferencesService used to add a logical reference between one and another node.

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

<dl class="api-definition">
<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>Members</dt>
<dd><a href="./members">OpcAddReference Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Defines a single command of the [IOpcAddReferencesService](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcaddreferencesservice/) used to add a logical reference between one and another node.

## Syntax

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

```csharp
public class OpcAddReference : OpcNodeServiceCommand
```

</div>

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

```vbnet
Public Class OpcAddReference
    Inherits OpcNodeServiceCommand
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → [OpcServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicecommand/) → [OpcNodeServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcnodeservicecommand/) → **OpcAddReference**

## Constructors

| Name | Description |
|---|---|
| [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#opcaddreference)<span class="api-meta">4 overloads</span> | Initializes a new instance of the OpcAddReference class using the identifiers of the nodes which shall reference each other. |

## Properties

| Name | Description |
|---|---|
| [Direction](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#direction) | Gets a value indicating the logical direction of the reference to add. |
| [ReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#referencetype) | Gets a value which defines a pre-defined used [ReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#referencetypeid) as one of the members defined by the [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) enumeration to simplify querying standard reference types. |
| [ReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#referencetypeid) | Gets the identifier which identifies the node that defines the semantic of the reference between the source and the target node and generally reflects an operation between the two, such as "A contains B". |
| [TargetNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodecategory) | Gets the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) of the target node identified by [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid). |
| [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid) | Gets the identifier which identifies the target node which acts as the opponent in the reference to construct between the source node (identified by [NodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcnodeservicecommand/members#nodeid)) the target node. |
| [TargetServerUri](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetserveruri) | Gets or sets the [Uri](https://learn.microsoft.com/dotnet/api/system.uri) of the remote server which provides the node identified by [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid). |

## Methods

| Name | Description |
|---|---|
| [ToObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#toobject)<span class="api-meta">static · 4 overloads</span> | Creates a new instance of the OpcAddReference class using the identifiers of the nodes which shall reference each other. |
| [ToVariable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#tovariable)<span class="api-meta">static · 4 overloads</span> | Creates a new instance of the OpcAddReference class using the identifiers of the nodes which shall reference each other. |

Inherits members from [OpcNodeServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcnodeservicecommand/members), [OpcServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicecommand/members).

## Applies to

| Package | Versions |
|---|---|
| Opc.UaFx.Advanced | v2.7–v2.59 |
