# OpcDataTypeAttribute Members

> Reference: Defines the identifier of 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="./">OpcDataTypeAttribute</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

### OpcDataTypeAttribute

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

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

#### OpcDataTypeAttribute(byte\[\])

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

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

```csharp
public OpcDataTypeAttribute(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 node. |

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

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

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

```csharp
public OpcDataTypeAttribute(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 node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type node belongs. |

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

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

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

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

```csharp
public OpcDataTypeAttribute(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 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.opcdatatypeattribute/members#id) should refer to. |

#### OpcDataTypeAttribute(int)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |

#### OpcDataTypeAttribute(int, int)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type node belongs. |

#### OpcDataTypeAttribute(int, string)

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

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

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

```csharp
public OpcDataTypeAttribute(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 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.opcdatatypeattribute/members#id) should refer to. |

#### OpcDataTypeAttribute(uint)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |

#### OpcDataTypeAttribute(uint, int)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type node belongs. |

#### OpcDataTypeAttribute(uint, string)

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

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

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

```csharp
public OpcDataTypeAttribute(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 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.opcdatatypeattribute/members#id) should refer to. |

#### OpcDataTypeAttribute(string)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |

#### OpcDataTypeAttribute(string, int)

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

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

```csharp
public OpcDataTypeAttribute(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 node. |
| `namespaceIndex` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the namespace to that the data type node belongs. |

#### OpcDataTypeAttribute(string, string)

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

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

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

```csharp
public OpcDataTypeAttribute(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 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.opcdatatypeattribute/members#id) should refer to. |

## Properties

### Description

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

Gets or sets a human readable text that describes the data type.

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

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

</div>

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

```vbnet
Public Property Description As String
```

</div>

**Property value**

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

A value which captures any semantic information that whould help a human to unterstand what is contained in the data type.

### Id

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

### Name

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

Gets or sets the name of the data type.

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

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

</div>

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

```vbnet
Public Property Name As String
```

</div>

**Property value**

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

The name which identifies the data type.

### NamespaceUri

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

Gets or sets the URI (Uniform Resource Identifier) or string literal used to identify the namespace 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 type 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 within the type is described.

### UseDataTypeDefinition

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

Gets or sets a value indicating whether the data type is to be declared in a custom data type definition.

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

```csharp
public bool UseDataTypeDefinition { get; set; }
```

</div>

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

```vbnet
Public Property UseDataTypeDefinition As Boolean
```

</div>

**Property value**

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

The value if the data type is to be declared in a custom data type definition; otherwise the value false. The default value is true.

### UseDataTypeDescription

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

Gets or sets a value indicating whether the data type is to be declared in a custom data type dictionary.

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

```csharp
public bool UseDataTypeDescription { get; set; }
```

</div>

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

```vbnet
Public Property UseDataTypeDescription As Boolean
```

</div>

**Property value**

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

The value if the data type is to be declared in a custom data type dictionary; otherwise the value false. The default value is true.

## Methods

### GetNamespace

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

Retrieves the [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) referenced to by the [OpcDataTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeattribute/).

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

```csharp
public OpcNamespace GetNamespace()
```

</div>

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

```vbnet
Public Function GetNamespace() As OpcNamespace
```

</div>

**Returns**

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

A new [OpcNamespace](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamespace/) instance which represents the namespace information referenced by the [OpcDataTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeattribute/).
