# OpcStructField Class

> Reference: Represents a field of a structure defined using OpcStruct.

<span class="api-meta">since v2.53</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">OpcStructField Members</a></dd>
</dl>

Represents a field of a structure defined using [OpcStruct](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstruct/).

## Syntax

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

```csharp
public class OpcStructField
```

</div>

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

```vbnet
Public Class OpcStructField
```

</div>

## Inheritance

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

## Derived types

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

## Remarks

The methods [AsArray](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#asarray-noparams) and [AsOptional](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#asoptional-noparams) change the field and return the field itself, so that they can be chained.

## Constructors

| Name | Description |
|---|---|
| [OpcStructField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#opcstructfield)<span class="api-meta">2 overloads</span> | Initializes a new instance of the OpcStructField class using the unique `name` and `fieldTypeId` of the structure field to define. |

## Properties

| Name | Description |
|---|---|
| [ArrayRank](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#arrayrank) | Gets the number of dimensions of the field if it is an array. |
| [Description](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#description) | Gets description of the structure field which defines the purpose of the field. |
| [FieldTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#fieldtypeid) | Gets the identifier of the data type of the value of the field. |
| [IsArray](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#isarray) | Gets a value indicating whether the field is an array. |
| [IsOptional](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#isoptional) | Gets a value indicating whether the field is optional. |
| [Length](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#length) | Gets the length of the field if it is an array. |
| [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#name) | Gets the name of the structure field which unique identifies the field in the structure. |
| [Switch](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#switch) | Gets the switch which controls the existence of the field if it is optional. |

## Methods

| Name | Description |
|---|---|
| [AsArray](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#asarray)<span class="api-meta">5 overloads</span> | Declares the field as a one-dimensional array with a variable length. |
| [AsOptional](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstructfield/members#asoptional)<span class="api-meta">2 overloads</span> | Declares the field as optional. |

## Applies to

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