# OpcRawObject Members

> Reference: Represents the value of a structured data type which could not be decoded, as its sender encoded it.

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

## Properties

### Encoding

Gets the encoding in which the value is encoded.

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

```csharp
public OpcEncoding Encoding { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Encoding As OpcEncoding
```

</div>

**Property value**

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

An instance of the [OpcEncoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/) class whose [Id](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/members#id) identifies the encoding of the data type and whose [Type](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencoding/members#type) states whether the [RawData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#rawdata) is binary or XML encoded.

### RawData

Gets the encoded value.

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

```csharp
public object RawData { get; }
```

</div>

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

```vbnet
Public ReadOnly Property RawData As Object
```

</div>

**Property value**

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

An array of [byte](https://learn.microsoft.com/dotnet/api/system.byte) values if the [Encoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#encoding) is [Binary](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/#binary); or an [XmlElement](https://learn.microsoft.com/dotnet/api/system.xml.xmlelement) if it is [Xml](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingtype/#xml).

## Methods

### Decode

Decodes the [RawData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#rawdata) as the `T` defined.

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

```csharp
public T Decode<T>(OpcContext context) where T : new()
```

</div>

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

```vbnet
Public Function Decode(Of T As New)(context As OpcContext) As T
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type to decode with a default constructor. |

**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 decode the [RawData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#rawdata). |

**Returns**

T

A new instance of the type defined by `T` and decoded with the information in the [RawData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#rawdata).

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `context` is a null reference (Nothing in Visual Basic). |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The decoding has failed. For more details exception data. |

**Remarks**

This method is equivalent to [Decode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdata/members#decode-t1-opc-uafx-opccontext-opc-uafx-opcrawobject).

### GetTypeInfo

Gets the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) of the data type of the value represented.

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

```csharp
public OpcDataTypeInfo GetTypeInfo()
```

</div>

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

```vbnet
Public Function GetTypeInfo() As OpcDataTypeInfo
```

</div>

**Returns**

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

An [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) whose [IsUnknown](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/members#isunknown) is true and which provides the [Encoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#encoding) and, of an XML encoded value, the name of the data type. As an encoded value does not state its data type, the [TypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/members#typeid) is [Null](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/members#null).

**Remarks**

A client that knows the data type provides it by its GetDataType method with the [Encoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#encoding) of the value.

### ToString

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

Returns a [string](https://learn.microsoft.com/dotnet/api/system.string) representing the [Encoding](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/members#encoding) of the current [OpcRawObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/).

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

```csharp
public override string ToString()
```

</div>

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

```vbnet
Public Overrides Function ToString() As String
```

</div>

**Returns**

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

A [string](https://learn.microsoft.com/dotnet/api/system.string) representing the current [OpcRawObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcrawobject/).

**Overrides**

[ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)
