<PackageReference Include="System.Reactive" Version="6.0.0-preview.9" />

Timestamped<T>

public struct Timestamped<T> : IEquatable<Timestamped<T>>
Represents value with a timestamp on it. The timestamp typically represents the time the value was received, using an IScheduler's clock to obtain the current time.
using System.Collections.Generic; using System.Globalization; using System.Runtime.CompilerServices; namespace System.Reactive { [Serializable] [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public readonly struct Timestamped<[System.Runtime.CompilerServices.Nullable(2)] T> : IEquatable<Timestamped<T>> { public T Value { get; } public DateTimeOffset Timestamp { get; } public Timestamped(T value, DateTimeOffset timestamp) { Timestamp = timestamp; Value = value; } public void Deconstruct(out T value, out DateTimeOffset timestamp) { T value2 = Value; DateTimeOffset timestamp2 = Timestamp; value = value2; timestamp = timestamp2; } public bool Equals([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] Timestamped<T> other) { if (other.Timestamp.Equals(Timestamp)) return EqualityComparer<T>.Default.Equals(Value, other.Value); return false; } public static bool operator ==([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] Timestamped<T> first, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] Timestamped<T> second) { return first.Equals(second); } public static bool operator !=([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] Timestamped<T> first, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] Timestamped<T> second) { return !first.Equals(second); } [System.Runtime.CompilerServices.NullableContext(2)] public override bool Equals(object obj) { if (obj is Timestamped<T>) return Equals((Timestamped<T>)obj); return false; } public override int GetHashCode() { int hashCode = Timestamp.GetHashCode(); T value = Value; return hashCode ^ (value?.GetHashCode() ?? 1979); } public override string ToString() { return string.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Timestamp); } } }