# OpcDataField Members

> Reference: Represents a data field declared by the structured data type of a specific OpcDataObject instance.

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

### Exists

Gets a value indicating whether the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the field is part of the data object this field belongs to.

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

```csharp
public bool Exists { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Exists As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of this field is part of the data object this field belongs to; otherwise the value false.

### HasValue

Gets a value indicating whether the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) property has been set.

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

```csharp
public bool HasValue { get; }
```

</div>

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

```vbnet
Public ReadOnly Property HasValue As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) property has been seen; otherwise the value false.

### IsOptional

Gets a value indicating whether the current field might not necessarily exist in the data object this field belongs to.

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

```csharp
public bool IsOptional { get; }
```

</div>

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

```vbnet
Public ReadOnly Property IsOptional As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the field might not always exists; otherwise the value false.

### Length

Gets the length of the field expressed either explicit or implicit using a different [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/).

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

```csharp
public long Length { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Length As Long
```

</div>

**Property value**

[Int64](https://learn.microsoft.com/dotnet/api/system.int64)

The total number of elements in the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the field or -1 if this field neither uses an explicit nor implicit length.

### LengthField

Gets the field which explictly controls the [Length](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#length) of the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of this field.

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

```csharp
public OpcDataField LengthField { get; }
```

</div>

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

```vbnet
Public ReadOnly Property LengthField As OpcDataField
```

</div>

**Property value**

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

An instance of the [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/) in the data object (this field belongs to) which controls the length of the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the current field.

### Name

Gets the name of the current [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/).

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

```csharp
public string Name { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Name As String
```

</div>

**Property value**

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

A [string](https://learn.microsoft.com/dotnet/api/system.string) containing the name of this field.

### SwitchField

Gets the field which explictly controls the existence of the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of this field in the data object this field belongs to.

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

```csharp
public OpcDataField SwitchField { get; }
```

</div>

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

```vbnet
Public ReadOnly Property SwitchField As OpcDataField
```

</div>

**Property value**

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

An instance of the [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/) in the data object (this field belongs to) which controls the existence of the [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the current field.

### Value

Gets or sets the value associated with the current field.

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

```csharp
public object Value { get; set; }
```

</div>

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

```vbnet
Public Property Value As Object
```

</div>

**Property value**

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

The value associated with the current field or a null reference (Nothing in Visual Basic) if there is no value associated with the current field in the data object the field belongs to.

### ValueType

Gets the [Type](https://learn.microsoft.com/dotnet/api/system.type) of [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) the current field supports.

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

```csharp
public Type ValueType { get; }
```

</div>

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

```vbnet
Public ReadOnly Property ValueType As Type
```

</div>

**Property value**

[Type](https://learn.microsoft.com/dotnet/api/system.type)

The [Type](https://learn.microsoft.com/dotnet/api/system.type) of [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) supported.

## Methods

### ToString

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

Returns a [string](https://learn.microsoft.com/dotnet/api/system.string) representing the [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#name), [ValueType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#valuetype) and [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the current [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/).

<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 [Name](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#name),the [ValueType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#valuetype) and [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/members#value) of the current [OpcDataField](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatafield/).

**Overrides**

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