# OpcData Class

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

<dl class="api-definition">
<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>Members</dt>
<dd><a href="./members">OpcData Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Defines an abstract base class of data objects used and provided in the ecosystem of a specific OPC UA Server.

## Syntax

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

```csharp
public abstract class OpcData
```

</div>

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

```vbnet
<OpcDataType(22)>
Public MustInherit Class OpcData
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → **OpcData**

## Derived types

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

## Constructors

| Name | Description |
|---|---|
| [OpcData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#opcdata)<span class="api-meta">protected · 2 overloads</span> | Initializes a new instance of the OpcData class. |

## Properties

| Name | Description |
|---|---|
| [DataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#datastore)<span class="api-meta">protected</span> | Gets the [IOpcDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcdatastore/) which contains the data of this OpcData instance. |

## Methods

| Name | Description |
|---|---|
| [Decode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#decode)<span class="api-meta">static · 3 overloads</span> | Converts the `buffer` specified to the `T` defined. |
| [DeepCopy](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#deepcopy)<span class="api-meta">protected · virtual</span> | Creates a copy of the current OpcData, which the SDK uses whenever it copies an encodable value of it. |
| [Encode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#encode)<span class="api-meta">static · 2 overloads · since v2.58</span> | Encodes the `value` specified using its [Binary](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/#binary) encoding. |
| [GetDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#getdatastore)<span class="api-meta">protected · virtual · since v2.32</span> | Retrieves the [IOpcDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcdatastore/) which contains the data of this OpcData instance. |
| [GetType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#gettype)<span class="api-meta">static</span> | Retrieves the [Type](https://learn.microsoft.com/dotnet/api/system.type) which implementes the data type which is identified by the `typeId` specified. |
| [GetTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#gettypeinfo)<span class="api-meta">static · 4 overloads</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) which declares the data type implemented by the `T` specified. |
| [New](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#new)<span class="api-meta">static</span> | Creates a new instance of the [OpcDataObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdataobject/) class using the `dataType` specified. |
| [NewArray](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#newarray)<span class="api-meta">static</span> | Creates a one-dimensional array of [OpcDataObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdataobject/) objects using the `dataType` and `length` with zero-based indexing. |
| [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#registertype)<span class="api-meta">static · 6 overloads</span> | Registers the type defined by `T` as the data object type to create in case there a data instance is to be created for the type definition identified by the [OpcDataTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeattribute/) defined on the `T` specified. |
| [RegisterTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#registertypemapper)<span class="api-meta">static · 2 overloads · since v2.27</span> | Registers the `T` implementing the [IOpcDataTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcdatatypemapper/) interface as a custom mapper for data types. |
| [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#registertypes)<span class="api-meta">static · 3 overloads</span> | Registers all non-abstract types in the `assembly` specified which defines the [OpcDataTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeattribute/). |
| [ShallowCopy](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#shallowcopy)<span class="api-meta">protected · virtual</span> | Creates a shallow copy of the current OpcData. |
| [ToExtension](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#toextension)<span class="api-meta">static · since v2.40</span> | Wraps the `instance` into an <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.ExtensionObject">ExtensionObject</abbr>, so that it can be encoded as the instance of its data type. |
| [TryGetTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#trygettypemapper)<span class="api-meta">static · 3 overloads · since v2.27</span> | Determines the [IOpcDataTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcdatatypemapper/) associated with the type specified by `TSource`. |
| [UnregisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#unregistertype)<span class="api-meta">static · 3 overloads</span> | Unregisters the previously registered (see [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#registertype-t1)) type defined by `T` as the [object](https://learn.microsoft.com/dotnet/api/system.object) type to not longer create for the type definition identified by the [OpcDataTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeattribute/) defined on the `T` specified. |
| [UnregisterTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#unregistertypemapper)<span class="api-meta">static · 2 overloads · since v2.27</span> | Unregisters the `T` implementing the [IOpcDataTypeMapper](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcdatatypemapper/) interface as a custom mapper for data types. |
| [UnregisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#unregistertypes)<span class="api-meta">static · 3 overloads</span> | Unregisters all previously registered types (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#registertypes-system-reflection-assembly)) in the `assembly` specified. |

## Events

| Name | Description |
|---|---|
| [TypeResolve](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#typeresolve)<span class="api-meta">static</span> | Occurs when the resolution of a data type fails. |

## Applies to

| Package | Versions |
|---|---|
| Opc.UaFx.Advanced | v2.8–v2.59 |
