# OpcInstanceNode Members

> Reference: Defines the abstract base class of all instance nodes.

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

Inherits members from [OpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members).

## Properties

### DefaultReferenceTypeId

<span class="api-meta">protected · virtual</span>

Gets the default identifier which identifies the type that defines the underlying node reference within this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) is referenced by its parent node.

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

```csharp
protected virtual OpcNodeId DefaultReferenceTypeId { get; }
```

</div>

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

```vbnet
Protected Overridable ReadOnly Property DefaultReferenceTypeId 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 wihin this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) is referenced. These reference defines the typical behaviour of an instance node and its role in the address space regarding its parent. If there exists no specific reference type a null reference (Nothing in Visual Basic).

### DefaultTypeDefinitionId

<span class="api-meta">protected · virtual</span>

Gets the default identifier which identifies the node that defines the underlying node type from that this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) has been created.

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

```csharp
protected virtual OpcNodeId DefaultTypeDefinitionId { get; }
```

</div>

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

```vbnet
Protected Overridable ReadOnly Property DefaultTypeDefinitionId 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 type node from that this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) has been created from. These type node defines the typical structure of an instance node of its type definition. If there exists no specific type definition node a null reference (Nothing in Visual Basic).

### InheritReferenceTypeId

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

Gets a value indicating whether the [DefaultReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#defaultreferencetypeid) of the current node is to be used for its children nodes initial [ReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#referencetypeid). This applies only under the conditions where [ReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#referencetypeid) of the child node is a null reference (Nothing in Visual Basic) or the [DefaultReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#defaultreferencetypeid) of the child node is used.

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

```csharp
protected virtual bool InheritReferenceTypeId { get; }
```

</div>

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

```vbnet
Protected Overridable ReadOnly Property InheritReferenceTypeId As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true to inherit the [DefaultReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#defaultreferencetypeid) to the direct children nodes of the parent node; otherwise the value false. The default value is false.

### ModellingRuleId

Gets or sets the identifier which defines how the [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) is used for instantiation.

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

```csharp
public OpcNodeId ModellingRuleId { get; set; }
```

</div>

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

```vbnet
Public Property ModellingRuleId 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 rule which defined how the [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) is used for instantiation. This rule also defines subtyping rules for the [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/). If there does no specific rule apply to the node a null reference (Nothing in Visual Basic).

### Parent

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

Gets the parent node of the node.

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

```csharp
public override sealed IOpcNode Parent { get; }
```

</div>

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

```vbnet
Public NotOverridable Overrides ReadOnly Property Parent As IOpcNode
```

</div>

**Property value**

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

An instance implementing the [IOpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnode/) interface which represents the phyiscal parent of the node. In general a node can have multiple (logical) parent nodes, but this property provides the only physical parent node of the node. The value can also be a null reference (Nothing in Visual Basic) in case there the node does only have logical parent nodes.

**Overrides**

[Parent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#parent)

### ReferenceType

Gets a value which defines a pre-defined used [ReferenceTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/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.

### ReferenceTypeId

Gets or sets the identifier which identifies the node that defines the semantic of the reference between a source and a 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; set; }
```

</div>

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

```vbnet
Public 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 a target node. If there does no specific reference apply between the source and the target node a null reference (Nothing in Visual Basic).

**Remarks**

Since reference types will be used as filters in the browse service and in queries, the server shall provide all its reference types, directly or indirectly following hierarchical references starting from the "ReferenceTypes" object. This means that, whenever the client follows a reference, the server shall expose the type of this reference in the reference type hierarchy. It shall provide all reference types so that the client would be able, following the inverse subtype of references, to come to the base references reference type. It does not mean that the server shall expose the reference type that the client has not used any reference of.

### TypeDefinitionId

Gets or sets the identifier which identifies the node that defines the underlying node type from that this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) has been created.

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

```csharp
public OpcNodeId TypeDefinitionId { get; set; }
```

</div>

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

```vbnet
Public Property TypeDefinitionId 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 type node from that this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) has been created from. These type node defines the typical structure of an instance node of its type definition. If there exists no specific type definition node a null reference (Nothing in Visual Basic).

## Methods

### AddChild

Adds the `node` specified as a child node of this node.

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

```csharp
public void AddChild(OpcContext context, OpcInstanceNode node)
```

</div>

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

```vbnet
Public Sub AddChild(context As OpcContext, node As OpcInstanceNode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) to use to add the child node. |
| `node` | [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) | The [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) to add as a child node. |

**Exceptions**

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

**Remarks**

If this node has already been initialized, the `node` is initialized in the [Namespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#namespace) of this node before it is added. If the `context` is an [OpcNodeContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecontext/) of a node manager, the `node` is added to the node manager too.

### GetNodeValue

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

| Overload | Description |
|---|---|
| [GetNodeValue&lt;T&gt;(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#getnodevalue-t1-system-string)<span class="api-meta">since v2.20</span> | Retrieves the value of the child variable node with the `name` specified in the [Namespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#namespace) of this node. |
| [GetNodeValue&lt;T&gt;(OpcName)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#getnodevalue-t1-opc-uafx-opcname)<span class="api-meta">since v2.20</span> | Retrieves the value of the child variable node with the `name` specified. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | This node has no child variable node with the `name`. |

#### GetNodeValue&lt;T&gt;(string)

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

Retrieves the value of the child variable node with the `name` specified in the [Namespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#namespace) of this node.

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

```csharp
public T GetNodeValue<T>(string name = "")
```

</div>

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

```vbnet
Public Function GetNodeValue(Of T)(name As String = "") As T
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type of the value to retrieve. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `name` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the child variable node; by default the name of the calling member, e.g. of the property which provides the value. Optional, default `""`. |

**Returns**

T

The value of the child variable node if it is a `T`; otherwise the default value of `T`.

#### GetNodeValue&lt;T&gt;(OpcName)

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

Retrieves the value of the child variable node with the `name` specified.

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

```csharp
public T GetNodeValue<T>(OpcName name)
```

</div>

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

```vbnet
Public Function GetNodeValue(Of T)(name As OpcName) As T
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type of the value to retrieve. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `name` | [OpcName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcname/) | The [OpcName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcname/) of the child variable node. |

**Returns**

T

The value of the child variable node if it is a `T`; otherwise the default value of `T`.

**Exceptions**

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

### InitializeDefaults

<span class="api-meta">protected · override</span>

Initializes the default values used by the [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/).

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

```csharp
protected override void InitializeDefaults()
```

</div>

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

```vbnet
Protected Overrides Sub InitializeDefaults()
```

</div>

**Overrides**

[InitializeDefaults](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#initializedefaults)

**Remarks**

This method is used to ensure the availability of appropriate node specific default values. For more information like when this method is to be overwritten see [InitializeDefaults](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#initializedefaults).

### RemoveChild

Removes the `node` specified from the child nodes of this node.

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

```csharp
public void RemoveChild(OpcContext context, OpcInstanceNode node)
```

</div>

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

```vbnet
Public Sub RemoveChild(context As OpcContext, node As OpcInstanceNode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) to use to remove the child node. |
| `node` | [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) | The [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) to remove from the child nodes. |

**Exceptions**

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

**Remarks**

If the `context` is an [OpcNodeContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecontext/) of a node manager, the `node` is removed from the node manager too.

### RemoveNotifier

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

Removes the `node` from the collection of notifiers (= event sources) of this node.

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

```csharp
public override void RemoveNotifier(OpcContext context, IOpcNode node)
```

</div>

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

```vbnet
Public Overrides Sub RemoveNotifier(context As OpcContext, node As IOpcNode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) to use to remove the `node` as the notifying event source. |
| `node` | [IOpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnode/) | The [IOpcNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcnode/) instance no longer acting as the notifier. |

**Exceptions**

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

**Overrides**

[RemoveNotifier](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#removenotifier)

**Remarks**

If the `node` is the last notifier being removed from the collection of notifiers the [EventNotifier](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcattribute/#eventnotifier) attribute of this [OpcInstanceNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/) is unset from 'SubscribeToEvents'.

### SetNodeValue

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

| Overload | Description |
|---|---|
| [SetNodeValue&lt;T&gt;(string, T)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#setnodevalue-t1-system-string-t0)<span class="api-meta">since v2.20</span> | Changes the value of the child variable node with the `name` specified in the [Namespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#namespace) of this node and applies the change. |
| [SetNodeValue&lt;T&gt;(OpcName, T)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcinstancenode/members#setnodevalue-t1-opc-uafx-opcname-t0)<span class="api-meta">since v2.20</span> | Changes the value of the child variable node with the `name` specified and applies the change. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | This node has no child variable node with the `name`. |

#### SetNodeValue&lt;T&gt;(string, T)

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

Changes the value of the child variable node with the `name` specified in the [Namespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnode/members#namespace) of this node and applies the change.

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

```csharp
public void SetNodeValue<T>(string name = "", T value = default)
```

</div>

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

```vbnet
Public Sub SetNodeValue(Of T)(name As String = "", value As T = Nothing)
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type of the value to store. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `name` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the child variable node; by default the name of the calling member, e.g. of the property which stores the value. Optional, default `""`. |
| `value` | T | The new value of the child variable node. Optional, default `default`. |

#### SetNodeValue&lt;T&gt;(OpcName, T)

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

Changes the value of the child variable node with the `name` specified and applies the change.

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

```csharp
public void SetNodeValue<T>(OpcName name, T value)
```

</div>

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

```vbnet
Public Sub SetNodeValue(Of T)(name As OpcName, value As T)
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type of the value to store. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `name` | [OpcName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcname/) | The [OpcName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcname/) of the child variable node. |
| `value` | T | The new value of the child variable node. |

**Exceptions**

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