Table of Contents

Struct DataValue<T>

Namespace
Acuit.Pinpoint.IO.Testing.Data
Assembly
Acuit.Pinpoint.IO.Testing.Abstractions.dll

A data value that contains a non-numeric value.

public readonly struct DataValue<T> : IDataValue, IFormattable, IEquatable<DataValue<T>>

Type Parameters

T

The data value type.

Implements
Inherited Members
Extension Methods

Constructors

DataValue(T)

Initializes a new instance of the DataValue<T> struct from a value, without units or any special value formatting.

public DataValue(T value)

Parameters

value T

The value.

DataValue(T, IDataValueDescriptor)

Initializes a new instance of the DataValue<T> struct from a value and a specified descriptor.

public DataValue(T value, IDataValueDescriptor descriptor)

Parameters

value T

The value.

descriptor IDataValueDescriptor

The data value descriptor.

Exceptions

ArgumentNullException

descriptor is null.

Properties

Descriptor

Gets the data value descriptor.

public IDataValueDescriptor Descriptor { get; }

Property Value

IDataValueDescriptor

Inner

Gets the inner data value, or null if there is none.

public IDataValue Inner { get; }

Property Value

IDataValue

Remarks

This allows additional data to be added to data values, such as timestamps or validation results.

When this is set for a data value, Value and Descriptor must return the same values as those of Inner.

Value

Gets the value.

public T Value { get; }

Property Value

T

Methods

Equals(DataValue<T>)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(DataValue<T> other)

Parameters

other DataValue<T>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format to use, or null to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value, or null to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

Remarks

See Format(object, string, IFormatProvider) for a description of the supported formats.

Operators

operator ==(DataValue<T>, DataValue<T>)

Returns a value that indicates whether two specified DataValue<T> values are equal.

public static bool operator ==(DataValue<T> left, DataValue<T> right)

Parameters

left DataValue<T>

The first value to compare.

right DataValue<T>

The second value to compare.

Returns

bool

true if left and right are equal; otherwise, false.

implicit operator T(DataValue<T>)

Defines an implicit conversion of a given data value to its value type.

public static implicit operator T(DataValue<T> dataValue)

Parameters

dataValue DataValue<T>

A data value to implicitly convert.

Returns

T

implicit operator DataValue<T>(T)

Defines an implicit conversion of a given value to a data value for that value, without units or any special value formatting.

public static implicit operator DataValue<T>(T value)

Parameters

value T

A value to implicitly convert.

Returns

DataValue<T>

operator !=(DataValue<T>, DataValue<T>)

Returns a value that indicates whether two specified DataValue<T> values are not equal.

public static bool operator !=(DataValue<T> left, DataValue<T> right)

Parameters

left DataValue<T>

The first value to compare.

right DataValue<T>

The second value to compare.

Returns

bool

true if left and right are not equal; otherwise, false.