Struct Timestamped<T>
Represents a timestamped payload value.
public readonly struct Timestamped<T> : IEquatable<Timestamped<T>>
Type Parameters
T
The type of the value in the timestamped payload.
- Implements
- Inherited Members
Constructors
Timestamped(T, double)
Initializes a new instance of the Timestamped<T> class with the specified payload value and timestamp.
public Timestamped(T value, double seconds)
Parameters
value
TThe value of the timestamped payload.
seconds
doubleThe timestamp of the payload, in fractional seconds.
Properties
Seconds
Gets the timestamp of the payload, in fractional seconds.
public double Seconds { get; }
Property Value
Value
Gets the value of the timestamped payload.
public T Value { get; }
Property Value
- T
Methods
Deconstruct(out T, out double)
Deconstructs the components of a timestamped payload into separate variables.
public void Deconstruct(out T value, out double seconds)
Parameters
value
TThe value of the timestamped payload.
seconds
doubleThe timestamp of the payload, in fractional seconds.
Equals(Timestamped<T>)
Returns a value indicating whether this instance has the same value and timestamp as a specified Timestamped<T> structure.
public bool Equals(Timestamped<T> other)
Parameters
other
Timestamped<T>The Timestamped<T> structure to compare to this instance.
Returns
- bool
true if
other
has the same value and timestamp as this instance; otherwise, false.
Equals(object)
Tests to see whether the specified object is an Timestamped<T> structure with the same value and timestamp as this Timestamped<T> structure.
public override bool Equals(object obj)
Parameters
Returns
- bool
true if
obj
is an Timestamped<T> and has the same value and timestamp as this Timestamped<T>; otherwise, false.
GetHashCode()
Returns a hash code for this Timestamped<T> structure.
public override int GetHashCode()
Returns
- int
An integer value that specifies a hash value for this Timestamped<T> structure.
ToString()
Creates a string representation of this Timestamped<T> structure.
public override string ToString()
Returns
- string
A string containing the Value and Seconds properties of this Timestamped<T> structure.
Operators
operator ==(Timestamped<T>, Timestamped<T>)
Tests whether two Timestamped<T> structures are equal.
public static bool operator ==(Timestamped<T> left, Timestamped<T> right)
Parameters
left
Timestamped<T>The Timestamped<T> structure on the left of the equality operator.
right
Timestamped<T>The Timestamped<T> structure on the right of the equality operator.
Returns
- bool
true if
left
andright
have equal value and timestamp; otherwise, false.
operator !=(Timestamped<T>, Timestamped<T>)
Tests whether two Timestamped<T> structures are different.
public static bool operator !=(Timestamped<T> left, Timestamped<T> right)
Parameters
left
Timestamped<T>The Timestamped<T> structure on the left of the inequality operator.
right
Timestamped<T>The Timestamped<T> structure on the right of the inequality operator.
Returns
- bool
true if
left
andright
differ either in value or timestamp; false ifleft
andright
are equal.