# OpcValue&lt;T&gt; Members

> Reference: Stores a generic value optionally associated with status and timestamp information.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcValue&lt;T&gt;</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>

Inherits members from [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members).

## Constructors

### OpcValue

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

| Overload | Description |
|---|---|
| [OpcValue(T)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`. |
| [OpcValue(T, DateTime)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value` and the `sourceTimestamp` of the `value`. |
| [OpcValue(T, DateTime, OpcStatus)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime-opc-uafx-opcstatus) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `status` of the `value`. |
| [OpcValue(T, DateTime, OpcStatusCode)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime-opc-uafx-opcstatuscode) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `statusCode` of the `value`. |
| [OpcValue(T, DateTime, DateTime)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime-system-datetime) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `serverTimestamp` of the `value`. |
| [OpcValue(T, DateTime, DateTime, OpcStatus)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime-system-datetime-opc-uafx-opcstatus) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp`, `serverTimestamp` and `status` of the `value`. |
| [OpcValue(T, DateTime, DateTime, OpcStatusCode)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue-t0-system-datetime-system-datetime-opc-uafx-opcstatuscode) | Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp`, `serverTimestamp` and `statusCode` of the `value`. |

#### OpcValue(T)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`.

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

```csharp
public OpcValue(T value)
```

</div>

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

```vbnet
Public Sub New(value As T)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |

#### OpcValue(T, DateTime)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value` and the `sourceTimestamp` of the `value`.

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

```csharp
public OpcValue(T value, DateTime sourceTimestamp)
```

</div>

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

```vbnet
Public Sub New(value As T, sourceTimestamp As Date)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the `value`. |

#### OpcValue(T, DateTime, OpcStatus)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `status` of the `value`.

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

```csharp
public OpcValue(T value, DateTime sourceTimestamp, OpcStatus status)
```

</div>

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

```vbnet
Public Sub New(value As T, sourceTimestamp As Date, status As OpcStatus)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the value. |
| `status` | [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) | The status information associated with the `value`. |

#### OpcValue(T, DateTime, OpcStatusCode)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `statusCode` of the `value`.

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

```csharp
public OpcValue(T value, DateTime sourceTimestamp, OpcStatusCode statusCode)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Sub New(value As T, sourceTimestamp As Date, statusCode As OpcStatusCode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the value. |
| `statusCode` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | One of the [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) members which defines the status information associated with the `value`. |

#### OpcValue(T, DateTime, DateTime)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp` and `serverTimestamp` of the `value`.

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

```csharp
public OpcValue(T value, DateTime sourceTimestamp, DateTime serverTimestamp)
```

</div>

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

```vbnet
Public Sub New(value As T, sourceTimestamp As Date, serverTimestamp As Date)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the `value`. |
| `serverTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the server recorded the `value`. |

#### OpcValue(T, DateTime, DateTime, OpcStatus)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp`, `serverTimestamp` and `status` of the `value`.

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

```csharp
public OpcValue(
    T value,
    DateTime sourceTimestamp,
    DateTime serverTimestamp,
    OpcStatus status)
```

</div>

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

```vbnet
Public Sub New(
    value As T,
    sourceTimestamp As Date,
    serverTimestamp As Date,
    status As OpcStatus)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the `value`. |
| `serverTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the server recorded the `value`. |
| `status` | [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) | The status information associated with the `value`. |

#### OpcValue(T, DateTime, DateTime, OpcStatusCode)

Initializes a new instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class using the `value`, `sourceTimestamp`, `serverTimestamp` and `statusCode` of the `value`.

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

```csharp
public OpcValue(
    T value,
    DateTime sourceTimestamp,
    DateTime serverTimestamp,
    OpcStatusCode statusCode)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Sub New(
    value As T,
    sourceTimestamp As Date,
    serverTimestamp As Date,
    statusCode As OpcStatusCode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | T | The value to represent. |
| `sourceTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the source produced the `value`. |
| `serverTimestamp` | [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) | The timestamp at which the server recorded the `value`. |
| `statusCode` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | One of the [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) members which defines the status information associated with the `value`. |

## Properties

### DataTypeId

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

Gets the node identifier of the [DataType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#datatype) of the value represented.

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

```csharp
public override sealed OpcNodeId DataTypeId { get; }
```

</div>

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

```vbnet
Public NotOverridable Overrides ReadOnly Property DataTypeId As OpcNodeId
```

</div>

**Property value**

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

An instance of the [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) representing the node identifier of the [DataType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#datatype).

**Overrides**

[DataTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#datatypeid)

### Value

Gets or sets the `T` value represented.

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

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

</div>

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

```vbnet
Public Property Value As T
```

</div>

**Property value**

T

The value of the type `T` associated with the metadata represented.

### ValueAsObject

Gets or sets the value represented.

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

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

</div>

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

```vbnet
Public Property ValueAsObject As Object
```

</div>

**Property value**

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

The value associated with the metadata represented.

## Methods

### CompareTo

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

| Overload | Description |
|---|---|
| [CompareTo(object)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#compareto-system-object)<span class="api-meta">override</span> | Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with the `other`. |
| [CompareTo(OpcValue)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#compareto-opc-uafx-opcvalue)<span class="api-meta">override</span> | Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with another [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |
| [CompareTo(OpcValue&lt;T&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#compareto-opc-uafx-opcvalue-of-t0)<span class="api-meta">virtual</span> | Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with another [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

#### CompareTo(object)

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

Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with the `other`.

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

```csharp
public override int CompareTo(object other)
```

</div>

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

```vbnet
Public Overrides Function CompareTo(other As Object) As Integer
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [Object](https://learn.microsoft.com/dotnet/api/system.object) | The [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare with this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

**Returns**

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

A 32-bit signed integer that indicates the relative order of the objects being compared ([CompareTo(object)](https://learn.microsoft.com/dotnet/api/system.icomparable.compareto)).

**Overrides**

[CompareTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#compareto-system-object)

**Implements**

[CompareTo(object)](https://learn.microsoft.com/dotnet/api/system.icomparable.compareto)

#### CompareTo(OpcValue)

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

Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with another [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

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

```csharp
public override int CompareTo(OpcValue other)
```

</div>

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

```vbnet
Public Overrides Function CompareTo(other As OpcValue) As Integer
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) | The [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare with this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

**Returns**

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

A 32-bit signed integer that indicates the relative order of the objects being compared ([CompareTo(T)](https://learn.microsoft.com/dotnet/api/system.icomparable-1.compareto)).

**Overrides**

[CompareTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#compareto-opc-uafx-opcvalue)

#### CompareTo(OpcValue&lt;T&gt;)

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

Compares the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) with another [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

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

```csharp
public virtual int CompareTo(OpcValue<T> other)
```

</div>

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

```vbnet
Public Overridable Function CompareTo(other As OpcValue(Of T)) As Integer
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare with this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

**Returns**

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

A 32-bit signed integer that indicates the relative order of the objects being compared ([CompareTo(T)](https://learn.microsoft.com/dotnet/api/system.icomparable-1.compareto)).

**Implements**

[CompareTo(OpcValue&lt;T&gt;)](https://learn.microsoft.com/dotnet/api/system.icomparable-1.compareto)

### Equals

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

| Overload | Description |
|---|---|
| [Equals(object)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#equals-system-object)<span class="api-meta">override</span> | Determines whether the specified `other` is equal to this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |
| [Equals(OpcValue)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#equals-opc-uafx-opcvalue)<span class="api-meta">override</span> | Determines whether the specified `other` is equal to this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |
| [Equals(OpcValue&lt;T&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#equals-opc-uafx-opcvalue-of-t0)<span class="api-meta">virtual</span> | Determines whether the specified `other` is equal to this [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/). |

#### Equals(object)

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

Determines whether the specified `other` is equal to this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

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

```csharp
public override bool Equals(object other)
```

</div>

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

```vbnet
Public Overrides Function Equals(other As Object) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [Object](https://learn.microsoft.com/dotnet/api/system.object) | The [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare to the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

**Returns**

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

The value true if the specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) is equal to the current [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/); otherwise the value false.

**Overrides**

[Equals](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#equals-system-object)

#### Equals(OpcValue)

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

Determines whether the specified `other` is equal to this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

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

```csharp
public override bool Equals(OpcValue other)
```

</div>

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

```vbnet
Public Overrides Function Equals(other As OpcValue) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) | The [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare to the current [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/). |

**Returns**

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

The value true if the specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) is equal to the current [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/); otherwise the value false.

**Overrides**

[Equals](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#equals-opc-uafx-opcvalue)

#### Equals(OpcValue&lt;T&gt;)

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

Determines whether the specified `other` is equal to this [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/).

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

```csharp
public virtual bool Equals(OpcValue<T> other)
```

</div>

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

```vbnet
Public Overridable Function Equals(other As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `other` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) to compare to the current [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/). |

**Returns**

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

The value true if the specified [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) is equal to the current [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/); otherwise the value false.

**Implements**

[Equals(OpcValue&lt;T&gt;)](https://learn.microsoft.com/dotnet/api/system.iequatable-1.equals)

### GetHashCode

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

Retrieves a hash code for this [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

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

```csharp
public override int GetHashCode()
```

</div>

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

```vbnet
Public Overrides Function GetHashCode() As Integer
```

</div>

**Returns**

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

An [int](https://learn.microsoft.com/dotnet/api/system.int32) that contains the hash code for the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/).

**Overrides**

[GetHashCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#gethashcode)

## Operators

### Equality

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

Returns a value indicating whether two instance of [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) are equal.

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

```csharp
public static bool operator ==(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator =(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare. |

**Returns**

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

The value true if left and right are equal; otherwise the value false.

### Explicit

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

Converts a [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to an <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> object.

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

```csharp
public static explicit operator DataValue(OpcValue<T> value)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Shared Narrowing Operator CType(value As OpcValue(Of T)) As DataValue
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | A [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) that represents the value. |

**Returns**

<abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr>

An instance of the <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> class initialized from the `value`.

### GreaterThan

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

Determines whether the first specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object is greater than the second specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static bool operator >(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator >(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |

**Returns**

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

The value true if `left` is greater than `right`; otherwise, false.

### GreaterThanOrEqual

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

Determines whether the first specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object is greater than or equal to the second specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static bool operator >=(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator >=(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |

**Returns**

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

The value true if `left` is greater than or equal to `right`; otherwise, false.

### Implicit

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

| Overload | Description |
|---|---|
| [implicit operator OpcValue&lt;T&gt;(DataValue)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-implicit-opc-ua-datavalue-opc-uafx-opcvalue-of-t0)<span class="api-meta">static</span> | Converts a <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> to an [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |
| [implicit operator OpcValue&lt;T&gt;(Variant)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-implicit-opc-ua-variant-opc-uafx-opcvalue-of-t0)<span class="api-meta">static</span> | Converts a <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.Variant">Variant</abbr> to an [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |

#### implicit operator OpcValue&lt;T&gt;(DataValue)

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

Converts a <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> to an [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static implicit operator OpcValue<T>(DataValue value)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Shared Widening Operator CType(value As DataValue) As OpcValue(Of T)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> | A <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> that represents the value. |

**Returns**

[OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/)

An instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class initialized from the `value`.

#### implicit operator OpcValue&lt;T&gt;(Variant)

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

Converts a <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.Variant">Variant</abbr> to an [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static implicit operator OpcValue<T>(Variant value)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Shared Widening Operator CType(value As [Variant]) As OpcValue(Of T)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `value` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.Variant">Variant</abbr> | A <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.Variant">Variant</abbr> that represents the value. |

**Returns**

[OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/)

An instance of the [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) class initialized from the `value`.

### Inequality

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

Returns a value indicating whether two instances of [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) are not equal.

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

```csharp
public static bool operator !=(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator <>(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) to compare. |

**Returns**

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

The value true if left and right are not equal; otherwise the value false.

### LessThan

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

Determines whether the first specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object is less than the second specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static bool operator <(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator <(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |

**Returns**

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

The value true if `left` is less than `right`; otherwise the value false.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `left` is a null reference (Nothing in Visual Basic). |

### LessThanOrEqual

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

Determines whether the first specified [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object is less than or equal to the second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object.

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

```csharp
public static bool operator <=(OpcValue<T> left, OpcValue<T> right)
```

</div>

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

```vbnet
Public Shared Operator <=(
    left As OpcValue(Of T),
    right As OpcValue(Of T)) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `left` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The first [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |
| `right` | [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) | The second [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) object. |

**Returns**

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

The value true if `left` is less than or equal to `right`; otherwise the value false.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `left` is a null reference (Nothing in Visual Basic). |
