# OpcValue&lt;T&gt; 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">OpcValue&lt;T&gt; Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

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

## Syntax

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

```csharp
public class OpcValue<T> : OpcValue
```

</div>

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

```vbnet
Public Class OpcValue(Of T)
    Inherits OpcValue
```

</div>

## Type parameters

| Name | Description |
|---|---|
| `T` |  |

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) → **OpcValue&lt;T&gt;**

## 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;<a href="../opc.uafx.opcvalue/">OpcValue</a>&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.icomparable-1">IComparable</a>&lt;OpcValue&lt;T&gt;&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable</a>&lt;<a href="../opc.uafx.opcvalue/">OpcValue</a>&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable</a>&lt;OpcValue&lt;T&gt;&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.iformattable">IFormattable</a></li>
</ul>

## Derived types

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

## Constructors

| Name | Description |
|---|---|
| [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#opcvalue)<span class="api-meta">7 overloads</span> | Initializes a new instance of the OpcValue&lt;T&gt; class using the `value`. |

## Properties

| Name | Description |
|---|---|
| [DataTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#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. |
| [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#value) | Gets or sets the `T` value represented. |
| [ValueAsObject](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#valueasobject) | Gets or sets the value represented. |

## Methods

| Name | Description |
|---|---|
| [CompareTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#compareto)<span class="api-meta">3 overloads</span> | Compares the current OpcValue&lt;T&gt; with the `other`. |
| [Equals](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#equals)<span class="api-meta">3 overloads</span> | Determines whether the specified `other` is equal to this OpcValue&lt;T&gt;. |
| [GetHashCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#gethashcode)<span class="api-meta">override</span> | Retrieves a hash code for this OpcValue&lt;T&gt;. |

## Operators

| Name | Description |
|---|---|
| [Equality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-equality)<span class="api-meta">static</span> | Returns a value indicating whether two instance of OpcValue&lt;T&gt; are equal. |
| [Explicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-explicit)<span class="api-meta">static</span> | Converts a OpcValue&lt;T&gt; to an <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> object. |
| [GreaterThan](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-greaterthan)<span class="api-meta">static</span> | Determines whether the first specified OpcValue&lt;T&gt; object is greater than the second specified OpcValue&lt;T&gt; object. |
| [GreaterThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-greaterthanorequal)<span class="api-meta">static</span> | Determines whether the first specified OpcValue&lt;T&gt; object is greater than or equal to the second specified OpcValue&lt;T&gt; object. |
| [Implicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-implicit)<span class="api-meta">static · 2 overloads</span> | Converts a <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DataValue">DataValue</abbr> to an OpcValue&lt;T&gt; object. |
| [Inequality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-inequality)<span class="api-meta">static</span> | Returns a value indicating whether two instances of OpcValue&lt;T&gt; are not equal. |
| [LessThan](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-lessthan)<span class="api-meta">static</span> | Determines whether the first specified OpcValue&lt;T&gt; object is less than the second specified OpcValue&lt;T&gt; object. |
| [LessThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#op-lessthanorequal)<span class="api-meta">static</span> | Determines whether the first specified OpcValue&lt;T&gt; object is less than or equal to the second OpcValue&lt;T&gt; object. |

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

## Applies to

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