Struct TimeStamp
Calendar-date-backed ITimeStamp. Time-of-day is intentionally discarded; financial contracts settle on calendar dates.
public readonly record struct TimeStamp : ITimeStamp, IComparable<ITimeStamp>, IEquatable<ITimeStamp>, IEquatable<TimeStamp>
- Implements
- Inherited Members
Examples
var t = TimeStamp.New(2024, 6, 1);
Console.WriteLine(t); // 2024-06-01
var later = t.AdvanceDays(7); // 2024-06-08
Constructors
TimeStamp(DateOnly)
Calendar-date-backed ITimeStamp. Time-of-day is intentionally discarded; financial contracts settle on calendar dates.
public TimeStamp(DateOnly Value)
Parameters
ValueDateOnly
Examples
var t = TimeStamp.New(2024, 6, 1);
Console.WriteLine(t); // 2024-06-01
var later = t.AdvanceDays(7); // 2024-06-08
Properties
Value
public DateOnly Value { get; init; }
Property Value
Methods
AdvanceDays(int)
Return a new TimeStamp advanced by days.
public TimeStamp AdvanceDays(int days)
Parameters
daysint
Returns
CompareTo(ITimeStamp?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(ITimeStamp? other)
Parameters
otherITimeStampAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(ITimeStamp?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ITimeStamp? other)
Parameters
otherITimeStampAn object to compare with this object.
Returns
New(int, int, int)
Construct a TimeStamp from year/month/day.
public static TimeStamp New(int year, int month, int day)
Parameters
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.