# OpcClient.GetDataType Method

> Reference: Retrieves the OpcDataTypeInfo object which is known under the name specified.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcClient</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.client">Opc.UaFx.Client</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Members</dt>
<dd><a href="./members">OpcClient Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

<span class="api-meta">6 overloads · since v2.9</span>

| Overload | Description |
|---|---|
| [GetDataType(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-system-string)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `name` specified. |
| [GetDataType(OpcName)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-opc-uafx-opcname)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `name` specified. |
| [GetDataType(OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-opc-uafx-opcnodeid)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type which is identified by the `typeId` specified. |
| [GetDataType(Type)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-system-type)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type implemented by the `underlyingType` specified. |
| [GetDataType(OpcEncoding)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-opc-uafx-opcencoding)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type which is identified by the `encoding` specified. |
| [GetDataType(XmlQualifiedName)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclient/getdatatype#getdatatype-system-xml-xmlqualifiedname)<span class="api-meta">since v2.9</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `xmlName` specified. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [ObjectDisposedException](https://learn.microsoft.com/dotnet/api/system.objectdisposedexception) | The object has been disposed of. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The service execution failed upon different circumstances; for more details see exception details. |

## GetDataType(string)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `name` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(string name)
```

</div>

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

```vbnet
Public Function GetDataType(name As String) As OpcDataTypeInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `name` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [string](https://learn.microsoft.com/dotnet/api/system.string) to use to identify the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object its [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/members#name) is equals (regarding its [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcname/members#value)) to the `name` specified; otherwise a null reference (Nothing in Visual Basic).

**Exceptions**

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

## GetDataType(OpcName)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `name` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(OpcName name)
```

</div>

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

```vbnet
Public Function GetDataType(name As OpcName) As OpcDataTypeInfo
```

</div>

**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 [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object its [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/members#name) is equals to the `name` specified; otherwise a null reference (Nothing in Visual Basic).

**Exceptions**

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

## GetDataType(OpcNodeId)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type which is identified by the `typeId` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(OpcNodeId typeId)
```

</div>

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

```vbnet
Public Function GetDataType(typeId As OpcNodeId) As OpcDataTypeInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `typeId` | [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 [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `typeId` specified or a null reference (Nothing in Visual Basic) if there doesn't exist a known [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is associated with the `typeId` specified.

**Exceptions**

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

## GetDataType(Type)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type implemented by the `underlyingType` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(Type underlyingType)
```

</div>

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

```vbnet
Public Function GetDataType(underlyingType As Type) As OpcDataTypeInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `underlyingType` | [Type](https://learn.microsoft.com/dotnet/api/system.type) | The [Type](https://learn.microsoft.com/dotnet/api/system.type) which implements the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the `underlyingType` specified or a null reference (Nothing in Visual Basic) if there isn't a [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object associated with the `underlyingType` specified.

**Exceptions**

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

## GetDataType(OpcEncoding)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which declares the type which is identified by the `encoding` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(OpcEncoding encoding)
```

</div>

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

```vbnet
Public Function GetDataType(encoding As OpcEncoding) As OpcDataTypeInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `encoding` | [OpcEncoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/) | The [OpcEncoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/) which identifies the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `encoding` specified or a null reference (Nothing in Visual Basic) if there doesn't exist a known [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) which is associated with the `encoding` specified.

**Exceptions**

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

## GetDataType(XmlQualifiedName)

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

Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `xmlName` specified.

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

```csharp
public OpcDataTypeInfo GetDataType(XmlQualifiedName xmlName)
```

</div>

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

```vbnet
Public Function GetDataType(xmlName As XmlQualifiedName) As OpcDataTypeInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `xmlName` | [XmlQualifiedName](https://learn.microsoft.com/dotnet/api/system.xml.xmlqualifiedname) | The [XmlQualifiedName](https://learn.microsoft.com/dotnet/api/system.xml.xmlqualifiedname) of the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object to retrieve. |

**Returns**

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

The [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object its [XmlName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/members#xmlname) is equals to the `xmlName` specified; otherwise a null reference (Nothing in Visual Basic).

**Exceptions**

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