# OpcEncodingMask Members

> Reference: Defines the characteristics of the 'EncodingMask' of a type with optional members.

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

## Constructors

### OpcEncodingMask

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

| Overload | Description |
|---|---|
| [OpcEncodingMask(OpcEncodingMaskKind)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#opcencodingmask-opc-uafx-opcencodingmaskkind) | Initializes a new instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class using the `kind` defined while the [Size](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#size) of the mask is determined depending on the [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) specified. |
| [OpcEncodingMask(OpcEncodingMaskKind, int)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#opcencodingmask-opc-uafx-opcencodingmaskkind-system-int32) | Initializes a new instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class using the `kind` and `sizeInBits` specified. |

#### OpcEncodingMask(OpcEncodingMaskKind)

Initializes a new instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class using the `kind` defined while the [Size](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#size) of the mask is determined depending on the [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) specified.

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

```csharp
public OpcEncodingMask(OpcEncodingMaskKind kind)
```

</div>

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

```vbnet
Public Sub New(kind As OpcEncodingMaskKind)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `kind` | [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) | The [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) value to use to control the definition and use of the 'EncodingMask'. |

#### OpcEncodingMask(OpcEncodingMaskKind, int)

Initializes a new instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class using the `kind` and `sizeInBits` specified.

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

```csharp
public OpcEncodingMask(OpcEncodingMaskKind kind, int sizeInBits)
```

</div>

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

```vbnet
Public Sub New(kind As OpcEncodingMaskKind, sizeInBits As Integer)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `kind` | [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) | The [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) value to use to control the definition and use of the 'EncodingMask'. |
| `sizeInBits` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The size in bits which have to be a multiple of eight. Each bit acquired by the 'EncodingMask' can be used by an optional member to control its existence within a data stream. In case there a value less than -1 is used the [SizeInBits](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#sizeinbits) is set to -1 which results into the same [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) as [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#opcencodingmask-opc-uafx-opcencodingmaskkind) would be used. |

## Properties

### Default

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

Gets the default characteristics used to encode optional members of a type using the [Explicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/#explicit).

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

```csharp
public static OpcEncodingMask Default { get; }
```

</div>

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

```vbnet
Public Shared ReadOnly Property [Default] As OpcEncodingMask
```

</div>

**Property value**

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

An instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class initialized with the default characteristics used to encode optional members using the [Explicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/#explicit).

### DefaultAuto

<span class="api-meta">static · since v2.50</span>

Gets the default characteristics used to encode optional members of a type using the [Auto](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/#auto).

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

```csharp
public static OpcEncodingMask DefaultAuto { get; }
```

</div>

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

```vbnet
Public Shared ReadOnly Property DefaultAuto As OpcEncodingMask
```

</div>

**Property value**

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

An instance of the [OpcEncodingMask](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/) class initialized with the default characteristics used to encode optional members using the [Auto](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/#auto).

### Kind

Gets a value which defines how the 'EncodingMask' of a type is used and an which way it is declared and used by the type to control the existence of its optional members.

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

```csharp
public OpcEncodingMaskKind Kind { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Kind As OpcEncodingMaskKind
```

</div>

**Property value**

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

One of the members defined by the [OpcEncodingMaskKind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmaskkind/) enumeration.

### Size

Gets the number of bytes to use for the 'EncodingMask'. Each bit in the bytes acquired by the 'EncodingMask' can be used to control the existence of optional members within a data stream.

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

```csharp
public int Size { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Size As Integer
```

</div>

**Property value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

The number of bytes to use or -1 in case there the size of the 'EncodingMask' is determined depending on the [Kind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#kind).

### SizeInBits

Gets the number of bits to use for the 'EncodingMask'. Each bit can be used to control the existence of optional members within a data stream.

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

```csharp
public int SizeInBits { get; }
```

</div>

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

```vbnet
Public ReadOnly Property SizeInBits As Integer
```

</div>

**Property value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

The number of bits to use or -1 in case there the number of bits required by the 'EncodingMask' is determined depending on the [Kind](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcencodingmask/members#kind).
