# ByteString Struct

> Reference: Defines a sequence of byte values.

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

Defines a sequence of [byte](https://learn.microsoft.com/dotnet/api/system.byte) values.

## Syntax

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

```csharp
public struct ByteString
```

</div>

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

```vbnet
<OpcDataType(15)>
Public Structure ByteString
```

</div>

## Implements

<ul class="api-implements">
<li><a href="https://learn.microsoft.com/dotnet/api/system.icomparable">IComparable</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.icomparable-1">IComparable</a>&lt;ByteString&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable</a>&lt;ByteString&gt;</li>
</ul>

## Constructors

| Name | Description |
|---|---|
| [ByteString](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#bytestring) | Initializes a new ByteString from the `value` specified. |

## Properties

| Name | Description |
|---|---|
| [Length](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#length) | Gets the total number of elements in all the dimensions of the ByteString. |

## Methods

| Name | Description |
|---|---|
| [CompareTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#compareto)<span class="api-meta">2 overloads</span> | Compares the current ByteString with the `other`. |
| [Equals](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#equals)<span class="api-meta">2 overloads</span> | Determines whether the specified `other` is equal to this ByteString. |
| [GetHashCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#gethashcode)<span class="api-meta">override</span> | Retrieves a hash code for this ByteString. |
| [Parse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#parse)<span class="api-meta">static</span> | Converts the specified hex encoded byte array to its ByteString equivalent. |
| [ToArray](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#toarray)<span class="api-meta">since v2.18</span> | Copies the [byte](https://learn.microsoft.com/dotnet/api/system.byte) values of the ByteString to a new array. |
| [ToString](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#tostring)<span class="api-meta">override</span> | Converts the value of this instance to its equivalent hex encoded string representation. |
| [TryParse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#tryparse)<span class="api-meta">static</span> | Tries to convert the specified hex encoded byte array to its ByteString equivalent. |

## Operators

| Name | Description |
|---|---|
| [Equality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-equality)<span class="api-meta">static</span> | Returns a value indicating whether two values of ByteString are equal. |
| [Explicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-explicit)<span class="api-meta">static</span> | Converts a ByteString to a [byte](https://learn.microsoft.com/dotnet/api/system.byte) array. |
| [GreaterThan](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-greaterthan)<span class="api-meta">static</span> | Determines whether the first specified ByteString value is greater than the second specified ByteString value. |
| [GreaterThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-greaterthanorequal)<span class="api-meta">static</span> | Determines whether the first specified ByteString value is greater than or equal to the second specified ByteString value. |
| [Implicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-implicit)<span class="api-meta">static · 2 overloads</span> | Converts a [byte](https://learn.microsoft.com/dotnet/api/system.byte) to a ByteString value. |
| [Inequality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-inequality)<span class="api-meta">static</span> | Returns a value indicating whether two values of ByteString are not equal. |
| [LessThan](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-lessthan)<span class="api-meta">static</span> | Determines whether the first specified ByteString value is less than the second specified ByteString value. |
| [LessThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#op-lessthanorequal)<span class="api-meta">static</span> | Determines whether the first specified ByteString value is less than or equal to the second ByteString value. |

## Indexers

| Name | Description |
|---|---|
| [Item](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.bytestring/members#item) | Gets the [byte](https://learn.microsoft.com/dotnet/api/system.byte) at the specified index. |

## Applies to

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