# OpcAddReference Members

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

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcAddReference</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 [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).

## Constructors

### OpcAddReference

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

| Overload | Description |
|---|---|
| [OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#opcaddreference-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcnodecategory) | Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. |
| [OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#opcaddreference-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcnodecategory-opc-uafx-opcreferencedirection) | Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection, OpcReferenceType)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#opcaddreference-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcnodecategory-opc-uafx-opcreferencedirection-opc-uafx-opcreferencetype) | Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#opcaddreference-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcnodecategory-opc-uafx-opcreferencedirection-opc-uafx-opcnodeid) | Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |

#### OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory)

Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. The new reference will be a [ParentToChild](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/#parenttochild) relation using [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference.

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

```csharp
public OpcAddReference(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcNodeCategory targetNodeCategory)
```

</div>

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

```vbnet
Public Sub New(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    targetNodeCategory As OpcNodeCategory)
```

</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 source node can be identified and accessed. This identifier refers to the 'child' node. |
| `targetNodeId` | [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 target node can be identified and accessed. This identifier referes to the 'parent' node. |
| `targetNodeCategory` | [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) | One of the members defined by the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) enumeration which is used by the server to validate that the reference to be added matches the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) of the target node identified by the `targetNodeId`. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection)

Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference.

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

```csharp
public OpcAddReference(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcNodeCategory targetNodeCategory,
    OpcReferenceDirection direction)
```

</div>

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

```vbnet
Public Sub New(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    targetNodeCategory As OpcNodeCategory,
    direction As OpcReferenceDirection)
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target node can be identified and accessed. |
| `targetNodeCategory` | [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) | One of the members defined by the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) enumeration which is used by the server to validate that the reference to be added matches the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) of the target node identified by the `targetNodeId`. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection, OpcReferenceType)

Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the `referenceType` specified as the type of reference.

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

```csharp
public OpcAddReference(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcNodeCategory targetNodeCategory,
    OpcReferenceDirection direction,
    OpcReferenceType referenceType)
```

</div>

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

```vbnet
Public Sub New(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    targetNodeCategory As OpcNodeCategory,
    direction As OpcReferenceDirection,
    referenceType As OpcReferenceType)
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target node can be identified and accessed. |
| `targetNodeCategory` | [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) | One of the members defined by the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) enumeration which is used by the server to validate that the reference to be added matches the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) of the target node identified by the `targetNodeId`. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceType` | [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) | One of the members defined by the [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) enumeration to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### OpcAddReference(OpcNodeId, OpcNodeId, OpcNodeCategory, OpcReferenceDirection, OpcNodeId)

Initializes a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the type of reference identified by the `referenceTypeId` specified.

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

```csharp
public OpcAddReference(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcNodeCategory targetNodeCategory,
    OpcReferenceDirection direction,
    OpcNodeId referenceTypeId)
```

</div>

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

```vbnet
Public Sub New(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    targetNodeCategory As OpcNodeCategory,
    direction As OpcReferenceDirection,
    referenceTypeId 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 source node can be identified and accessed. |
| `targetNodeId` | [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 target node can be identified and accessed. |
| `targetNodeCategory` | [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) | One of the members defined by the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) enumeration which is used by the server to validate that the reference to be added matches the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) of the target node identified by the `targetNodeId`. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceTypeId` | [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/) which identifies the type of reference to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Exceptions**

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

## Properties

### Direction

Gets a value indicating the logical direction of the reference to add.

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

```csharp
public OpcReferenceDirection Direction { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Direction As OpcReferenceDirection
```

</div>

**Property value**

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

One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration. The default value is [ParentToChild](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/#parenttochild).

### 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.

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

```csharp
public OpcReferenceType ReferenceType { get; }
```

</div>

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

```vbnet
Public ReadOnly Property ReferenceType As OpcReferenceType
```

</div>

**Property value**

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

One of the members defined by the [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) enumeration. The default value is [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes).

### 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".

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

```csharp
public OpcNodeId ReferenceTypeId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property ReferenceTypeId As OpcNodeId
```

</div>

**Property value**

[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/) of the reference type node which defines the relation semantic between the source and the target node. The default value is [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetypes/members#organizes).

### 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). The client shall define the concrete category of node the [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid) refers to, since the target node might not be accessible directly by the server. Additionally the server uses the category to validate that the reference to be added matches the category of node of the target node identified by the [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid).

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

```csharp
public OpcNodeCategory TargetNodeCategory { get; }
```

</div>

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

```vbnet
Public ReadOnly Property TargetNodeCategory As OpcNodeCategory
```

</div>

**Property value**

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

One of the members defined by the [OpcNodeCategory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/) enumeration which defines the category of node of the target node to reference.

### 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.

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

```csharp
public OpcNodeId TargetNodeId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property TargetNodeId As OpcNodeId
```

</div>

**Property value**

[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/) of the target node acting as the opponent of the reference to add.

### 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).

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

```csharp
public Uri TargetServerUri { get; set; }
```

</div>

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

```vbnet
Public Property TargetServerUri As Uri
```

</div>

**Property value**

[Uri](https://learn.microsoft.com/dotnet/api/system.uri)

An instance of the [Uri](https://learn.microsoft.com/dotnet/api/system.uri) class which provides the full qualified resource identifier to access the server of the target node identified by the [TargetNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#targetnodeid) or a null reference (Nothing in Visual Basic) if the command receiving server shall execute this command (the default value).

## Methods

### ToObject

<span class="api-meta">static · 4 overloads</span>

| Overload | Description |
|---|---|
| [ToObject(OpcNodeId, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#toobject-opc-uafx-opcnodeid-opc-uafx-opcnodeid)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. |
| [ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#toobject-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcReferenceType)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#toobject-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection-opc-uafx-opcreferencetype)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#toobject-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection-opc-uafx-opcnodeid)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |

#### ToObject(OpcNodeId, OpcNodeId)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. The new reference will be a [ParentToChild](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/#parenttochild) relation using [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference while the target node shall be a node of the category [Object](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#object).

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

```csharp
public static OpcAddReference ToObject(OpcNodeId nodeId, OpcNodeId targetNodeId)
```

</div>

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

```vbnet
Public Shared Function ToObject(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId) As OpcAddReference
```

</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 source node can be identified and accessed. This identifier refers to the 'child' node. |
| `targetNodeId` | [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 target object node can be identified and accessed. This identifier referes to the 'parent' node. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference while the target node shall be a node of the category [Object](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#object).

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

```csharp
public static OpcAddReference ToObject(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction)
```

</div>

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

```vbnet
Public Shared Function ToObject(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target object node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcReferenceType)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the `referenceType` specified as the type of reference while the target node shall be a node of the category [Object](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#object).

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

```csharp
public static OpcAddReference ToObject(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction,
    OpcReferenceType referenceType)
```

</div>

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

```vbnet
Public Shared Function ToObject(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection,
    referenceType As OpcReferenceType) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target object node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceType` | [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) | One of the members defined by the [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) enumeration to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToObject(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcNodeId)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the type of reference identified by the `referenceTypeId` specified while the target node shall be a node of the category [Object](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#object).

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

```csharp
public static OpcAddReference ToObject(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction,
    OpcNodeId referenceTypeId)
```

</div>

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

```vbnet
Public Shared Function ToObject(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection,
    referenceTypeId As OpcNodeId) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target object node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceTypeId` | [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/) which identifies the type of reference to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId`, `targetNodeId` or `referenceTypeId` 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`, `targetNodeId` or `referenceTypeId` is a null reference (Nothing in Visual Basic). |

### ToVariable

<span class="api-meta">static · 4 overloads</span>

| Overload | Description |
|---|---|
| [ToVariable(OpcNodeId, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#tovariable-opc-uafx-opcnodeid-opc-uafx-opcnodeid)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. |
| [ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#tovariable-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcReferenceType)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#tovariable-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection-opc-uafx-opcreferencetype)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |
| [ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/members#tovariable-opc-uafx-opcnodeid-opc-uafx-opcnodeid-opc-uafx-opcreferencedirection-opc-uafx-opcnodeid)<span class="api-meta">static</span> | Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. |

#### ToVariable(OpcNodeId, OpcNodeId)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other. The new reference will be a [ParentToChild](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/#parenttochild) relation using [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference while the target node shall be a node of the category [Variable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#variable).

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

```csharp
public static OpcAddReference ToVariable(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId)
```

</div>

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

```vbnet
Public Shared Function ToVariable(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId) As OpcAddReference
```

</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 source node can be identified and accessed. This identifier refers to the 'child' node. |
| `targetNodeId` | [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 target variable node can be identified and accessed. This identifier referes to the 'parent' node. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the [Organizes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/#organizes) as the type of reference while the target node shall be a node of the category [Variable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#variable).

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

```csharp
public static OpcAddReference ToVariable(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction)
```

</div>

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

```vbnet
Public Shared Function ToVariable(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target variable node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcReferenceType)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the `referenceType` specified as the type of reference while the target node shall be a node of the category [Variable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#variable).

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

```csharp
public static OpcAddReference ToVariable(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction,
    OpcReferenceType referenceType)
```

</div>

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

```vbnet
Public Shared Function ToVariable(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection,
    referenceType As OpcReferenceType) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target variable node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceType` | [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) | One of the members defined by the [OpcReferenceType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencetype/) enumeration to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId` or `targetNodeId` 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` or `targetNodeId` is a null reference (Nothing in Visual Basic). |

#### ToVariable(OpcNodeId, OpcNodeId, OpcReferenceDirection, OpcNodeId)

<span class="api-meta">static</span>

Creates a new instance of the [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/) class using the identifiers of the nodes which shall reference each other using the `direction` specified. The new reference will use the relation defined by `direction` using the type of reference identified by the `referenceTypeId` specified while the target node shall be a node of the category [Variable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecategory/#variable).

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

```csharp
public static OpcAddReference ToVariable(
    OpcNodeId nodeId,
    OpcNodeId targetNodeId,
    OpcReferenceDirection direction,
    OpcNodeId referenceTypeId)
```

</div>

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

```vbnet
Public Shared Function ToVariable(
    nodeId As OpcNodeId,
    targetNodeId As OpcNodeId,
    direction As OpcReferenceDirection,
    referenceTypeId As OpcNodeId) As OpcAddReference
```

</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 source node can be identified and accessed. |
| `targetNodeId` | [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 target variable node can be identified and accessed. |
| `direction` | [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) | One of the members defined by the [OpcReferenceDirection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedirection/) enumeration which defines the kind of relation the reference will construct. |
| `referenceTypeId` | [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/) which identifies the type of reference to use to setup the reference between the source and the target node identified by the `nodeId` and the `targetNodeId`. |

**Returns**

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

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `nodeId`, `targetNodeId` or `referenceTypeId` 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`, `targetNodeId` or `referenceTypeId` is a null reference (Nothing in Visual Basic). |
