Struct ReadingValue<T>
A reading value for a non-numeric value.
public readonly struct ReadingValue<T> : IReadingValue, IDataValue, IFormattable, IEquatable<ReadingValue<T>>
Type Parameters
TThe data value type.
- Implements
- Inherited Members
- Extension Methods
Constructors
ReadingValue(T, IReadingDescriptor)
Initializes a new instance of the ReadingValue<T> class.
public ReadingValue(T value, IReadingDescriptor descriptor)
Parameters
valueTThe value.
descriptorIReadingDescriptorThe reading descriptor.
Exceptions
- ArgumentNullException
descriptoris null.
Properties
Descriptor
Gets the reading value descriptor.
public IReadingDescriptor Descriptor { get; }
Property Value
Inner
Gets the inner data value, or null if there is none.
public IDataValue Inner { get; }
Property Value
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(ReadingValue<T>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ReadingValue<T> other)
Parameters
otherReadingValue<T>An object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
formatstringThe format to use, or null to use the default format defined for the type of the IFormattable implementation.
formatProviderIFormatProviderThe 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 ==(ReadingValue<T>, ReadingValue<T>)
Returns a value that indicates whether two specified ReadingValue<T> values are equal.
public static bool operator ==(ReadingValue<T> left, ReadingValue<T> right)
Parameters
leftReadingValue<T>The first value to compare.
rightReadingValue<T>The second value to compare.
Returns
operator !=(ReadingValue<T>, ReadingValue<T>)
Returns a value that indicates whether two specified ReadingValue<T> values are not equal.
public static bool operator !=(ReadingValue<T> left, ReadingValue<T> right)
Parameters
leftReadingValue<T>The first value to compare.
rightReadingValue<T>The second value to compare.