# OpcValue Class

<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 Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Stores a value optionally associated with status and timestamp information.

## Syntax

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

```csharp
public class OpcValue
```

</div>

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

```vbnet
Public Class OpcValue
```

</div>

## Inheritance

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

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

## Derived types

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

## Constructors

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

## Properties

| Name | Description |
|---|---|
| [DataType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#datatype) | Gets the type of value represented. |
| [DataTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#datatypeid)<span class="api-meta">virtual</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. |
| [Rank](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#rank) | Gets the rank of the value represented. |
| [ServerPicoseconds](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#serverpicoseconds) | Gets or sets the difference between a high resolution timestamp with a resolution of 10 picoseconds and the [ServerTimestamp](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#servertimestamp) which only has a 100 ns resolution. |
| [ServerTimestamp](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#servertimestamp) | Gets or sets the timestamp at which the server recorded the value. |
| [SourcePicoseconds](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#sourcepicoseconds) | Gets or sets the difference between a high resolution timestamp with a resolution of 10 picoseconds and the [SourceTimestamp](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#sourcetimestamp) which only has a 100 ns resolution. |
| [SourceTimestamp](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#sourcetimestamp) | Gets or sets the timestamp of the source from that the value originates. |
| [Status](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#status) | Gets the status information which defines the servers ability to access/provide the value. |
| [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#value) | Gets or sets the value represented. |

## Methods

| Name | Description |
|---|---|
| [As](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#as) | Retrieves the underlying [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#value) as the type specified by `T`. |
| [AsValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#asvalue)<span class="api-meta">since v2.8</span> | Retrieves a new [OpcValue&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/) instance its [Value](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue-1/members#value) is of the type specified by `T`. |
| [CompareTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#compareto)<span class="api-meta">virtual · 2 overloads</span> | Compares the current OpcValue with the `other`. |
| [Equals](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#equals)<span class="api-meta">2 overloads</span> | Determines whether the specified `other` is equal to this OpcValue. |
| [GetHashCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#gethashcode)<span class="api-meta">override</span> | Retrieves a hash code for this OpcValue. |
| [ToString](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#tostring)<span class="api-meta">2 overloads</span> | Converts the value of this instance to its equivalent string representation. |

## Operators

| Name | Description |
|---|---|
| [Equality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-equality)<span class="api-meta">static</span> | Returns a value indicating whether two instance of OpcValue are equal. |
| [Explicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-explicit)<span class="api-meta">static</span> | Converts a OpcValue 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/members#op-greaterthan)<span class="api-meta">static</span> | Determines whether the first specified OpcValue object is greater than the second specified OpcValue object. |
| [GreaterThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-greaterthanorequal)<span class="api-meta">static</span> | Determines whether the first specified OpcValue object is greater than or equal to the second specified OpcValue object. |
| [Implicit](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-implicit)<span class="api-meta">static · 29 overloads</span> | Converts a [bool](https://learn.microsoft.com/dotnet/api/system.boolean) to an OpcValue object. |
| [Inequality](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-inequality)<span class="api-meta">static</span> | Returns a value indicating whether two instances of OpcValue are not equal. |
| [LessThan](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-lessthan)<span class="api-meta">static</span> | Determines whether the first specified OpcValue object is less than the second specified OpcValue object. |
| [LessThanOrEqual](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/members#op-lessthanorequal)<span class="api-meta">static</span> | Determines whether the first specified OpcValue object is less than or equal to the second OpcValue object. |

## Applies to

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