# OpcDataTypeEncodingMaskAttribute Class

> Reference: Defines the size of the mask used to encode optional field information of the custom data type represented by the Type on that this attribute is applied.

<span class="api-meta">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">OpcDataTypeEncodingMaskAttribute Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Defines the size of the mask used to encode optional field information of the custom data type represented by the [Type](https://learn.microsoft.com/dotnet/api/system.type) on that this attribute is applied. The furthermore available [Kind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#kind) is used to determine whether the mask data is controlled by the data type or is to be determined and processed inline while reading or writing the custom data type. For more information about how an optional field is declared see [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/).

## Syntax

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

```csharp
public class OpcDataTypeEncodingMaskAttribute : Attribute
```

</div>

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

```vbnet
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Struct, AllowMultiple:=False, Inherited:=False)>
Public Class OpcDataTypeEncodingMaskAttribute
    Inherits Attribute
```

</div>

## Inheritance

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

## Constructors

| Name | Description |
|---|---|
| [OpcDataTypeEncodingMaskAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#opcdatatypeencodingmaskattribute)<span class="api-meta">2 overloads</span> | Initializes a new instance of the OpcDataTypeEncodingMaskAttribute class using the [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) value [Auto](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/#auto) and the smallest number of bytes required to represent the necessary bit mask to define the existence of optional fields. |

## Properties

| Name | Description |
|---|---|
| [Kind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#kind) | Gets the [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) which is used to determine whether the mask data is controlled by the data type or is to be determined and processed inline while reading or writing the custom data type. |
| [Size](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#size) | Gets or sets the number of bytes used to encode the existence of optional fields in the stream of the custom data type to that this attribute has been applied. |
| [SizeInBits](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#sizeinbits) | Gets or sets the number of bits to use to encode the existence of optional fields in the stream of the custom data type to that this attribute has been applied. |

## Methods

| Name | Description |
|---|---|
| [GetEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeencodingmaskattribute/members#getencodingmask) | Retrieves the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) information defined by the OpcDataTypeEncodingMaskAttribute. |

Inherits members from [Attribute](https://learn.microsoft.com/dotnet/api/system.attribute).

## Applies to

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