# OpcDataTypeMemberLengthAttribute Class

<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">OpcDataTypeMemberLengthAttribute Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Declares a field or property of a custom data type, to that the member belongs on that this attribute is applied, with a variable or fixed length of the member within the stream of its custom data type. Use this attribute to explicitly declare a field or property with a variable or fixed length. The length within the stream of its custom data type is declared either using the number of instances (= fixed length) using the constructor [OpcDataTypeMemberLengthAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#opcdatatypememberlengthattribute-system-int64) or using the value of a preceding member (= variable length) using the constructor [OpcDataTypeMemberLengthAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#opcdatatypememberlengthattribute-system-string).

## Syntax

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

```csharp
public class OpcDataTypeMemberLengthAttribute : Attribute
```

</div>

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

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

</div>

## Inheritance

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

## Constructors

| Name | Description |
|---|---|
| [OpcDataTypeMemberLengthAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#opcdatatypememberlengthattribute)<span class="api-meta">2 overloads</span> | Initializes a new instance of the OpcDataTypeMemberLengthAttribute class which declares a field or property with a fixed length. |

## Properties

| Name | Description |
|---|---|
| [Length](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#length) | Gets the total number of instances within the stream of the custom data type of the member the attribute belongs to. |
| [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#name) | Gets the name of the preceding member its value is to be evaluated to indicate the variable length of the member the attribute belongs to. |

## Methods

| Name | Description |
|---|---|
| [GetLength](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypememberlengthattribute/members#getlength) | Retrieves the [OpcMemberLength](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcmemberlength/) defined by the OpcDataTypeMemberLengthAttribute. |

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

## Applies to

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