# OpcDataTypeEncodingAttribute Members

> Reference: Defines the information about the encoding used for a custom data type which is represented by the Type on that this attribute is applied.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcDataTypeEncodingAttribute</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 [Attribute](https://learn.microsoft.com/dotnet/api/system.attribute).

## Constructors

### OpcDataTypeEncodingAttribute

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

| Overload | Description |
|---|---|
| [OpcDataTypeEncodingAttribute(byte\[\])](#opcdatatypeencodingattribute-system-byte-array) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(byte\[\], int)](#opcdatatypeencodingattribute-system-byte-array-system-int32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(byte\[\], string)](#opcdatatypeencodingattribute-system-byte-array-system-string) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(int)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-int32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(int, int)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-int32-system-int32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(int, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-int32-system-string) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(uint)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-uint32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(uint, int)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-uint32-system-int32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(uint, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-uint32-system-string) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-string) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(string, int)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-string-system-int32) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node. |
| [OpcDataTypeEncodingAttribute(string, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#opcdatatypeencodingattribute-system-string-system-string) | Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node. |

#### OpcDataTypeEncodingAttribute(byte\[\])

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(byte[] id)
```

</div>

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

```vbnet
Public Sub New(id As Byte())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Byte](https://learn.microsoft.com/dotnet/api/system.byte)[] | The opaque value of the data type encoding node. |

#### OpcDataTypeEncodingAttribute(byte\[\], int)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(byte[] id, int namespaceIndex)
```

</div>

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

```vbnet
Public Sub New(id As Byte(), namespaceIndex As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Byte](https://learn.microsoft.com/dotnet/api/system.byte)[] | The opaque value of the data type encoding node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type encoding node belongs. |

#### OpcDataTypeEncodingAttribute(byte\[\], string)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(byte[] id, string namespaceUri)
```

</div>

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

```vbnet
Public Sub New(id As Byte(), namespaceUri As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Byte](https://learn.microsoft.com/dotnet/api/system.byte)[] | The opaque value of the data type encoding node. |
| `namespaceUri` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The namespace URI that the [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#id) should refer to. |

#### OpcDataTypeEncodingAttribute(int)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(int id)
```

</div>

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

```vbnet
Public Sub New(id As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The numeric identifier of the data type encoding node. |

#### OpcDataTypeEncodingAttribute(int, int)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(int id, int namespaceIndex)
```

</div>

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

```vbnet
Public Sub New(id As Integer, namespaceIndex As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The numeric identifier of the data type encoding node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type encoding node belongs. |

#### OpcDataTypeEncodingAttribute(int, string)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(int id, string namespaceUri)
```

</div>

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

```vbnet
Public Sub New(id As Integer, namespaceUri As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The numeric identifier of the data type encoding node. |
| `namespaceUri` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The namespace URI that the [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#id) should refer to. |

#### OpcDataTypeEncodingAttribute(uint)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(uint id)
```

</div>

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

```vbnet
Public Sub New(id As UInteger)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [UInt32](https://learn.microsoft.com/dotnet/api/system.uint32) | The numeric identifier of the data type encoding node. |

#### OpcDataTypeEncodingAttribute(uint, int)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(uint id, int namespaceIndex)
```

</div>

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

```vbnet
Public Sub New(id As UInteger, namespaceIndex As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [UInt32](https://learn.microsoft.com/dotnet/api/system.uint32) | The numeric identifier of the data type encoding node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type encoding node belongs. |

#### OpcDataTypeEncodingAttribute(uint, string)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(uint id, string namespaceUri)
```

</div>

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

```vbnet
Public Sub New(id As UInteger, namespaceUri As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [UInt32](https://learn.microsoft.com/dotnet/api/system.uint32) | The numeric identifier of the data type encoding node. |
| `namespaceUri` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The namespace URI that the [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#id) should refer to. |

#### OpcDataTypeEncodingAttribute(string)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(string id)
```

</div>

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

```vbnet
Public Sub New(id As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The textual identifier of the data type encoding node. |

#### OpcDataTypeEncodingAttribute(string, int)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceIndex` to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(string id, int namespaceIndex)
```

</div>

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

```vbnet
Public Sub New(id As String, namespaceIndex As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The textual identifier of the data type encoding node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type encoding node belongs. |

#### OpcDataTypeEncodingAttribute(string, string)

Initializes a new instance of the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/) class using the `id` and `namespaceUri` specified to use to identify the according data type encoding node.

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

```csharp
public OpcDataTypeEncodingAttribute(string id, string namespaceUri)
```

</div>

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

```vbnet
Public Sub New(id As String, namespaceUri As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `id` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The textual identifier of the data type encoding node. |
| `namespaceUri` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The namespace URI that the [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#id) should refer to. |

## Properties

### Id

Gets the node identifier used to define the data type encoding node of the [Type](https://learn.microsoft.com/dotnet/api/system.type) to that the attribute has been applied.

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

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

</div>

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

```vbnet
Public ReadOnly Property Id As OpcNodeId
```

</div>

**Property value**

[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/) which identifies the data type encoding node of the [Type](https://learn.microsoft.com/dotnet/api/system.type) to that the attribute has been applied.

### NamespaceUri

Gets or sets the URI (Uniform Resource Identifier) or string literal used to identify the namespace the encoding of the [Type](https://learn.microsoft.com/dotnet/api/system.type), to that the attribute has been applied, belongs to.

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

```csharp
public string NamespaceUri { get; set; }
```

</div>

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

```vbnet
Public Property NamespaceUri As String
```

</div>

**Property value**

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

The URI (Uniform Resource Identifier) or string literal used to identify the namespace the encoding belongs to.

**Remarks**

The value of this property can be determined by reading the value attribute of the "NamespaceUri" variable node beneath the "DataTypeDictionary" variable node of the according "DataTypeSytem" object node like "OPC Binary" when using the [OpcEncodingType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/) for [Binary](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/#binary) or "XML Schema" when using the [OpcEncodingType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/) for [Xml](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/#xml). data encoding.

### Type

Gets or sets the type of encoding the node, referred to by the [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/members#id) property of this attribute, represents.

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

```csharp
public OpcEncodingType Type { get; set; }
```

</div>

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

```vbnet
Public Property Type As OpcEncodingType
```

</div>

**Property value**

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

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

## Methods

### GetEncoding

Retrieves the [OpcEncoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/) declared by the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/).

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

```csharp
public OpcEncoding GetEncoding()
```

</div>

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

```vbnet
Public Function GetEncoding() As OpcEncoding
```

</div>

**Returns**

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

A new [OpcEncoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/) instance which represents the encoding information declared by the [OpcDataTypeEncodingAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingattribute/).
