RateObservation Struct
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.dll
- Package
- Bodu.Financial 1.0.0
- Source
- RateObservation.cs
Represents a single observed exchange rate on a specific calendar date for a series.
public readonly struct RateObservation : IEquatable<RateObservation>
- Implements
- Inherited Members
- Extension Methods
Remarks
This type is a lightweight value carrier used by the series API in preference to repeated (DateOnly, decimal)
tuples. The surrounding series enforces the "strictly positive rate" and "unique date"
invariants; values constructed in isolation (including default(RateObservation)) carry no
validation guarantees.
Constructors
RateObservation(DateOnly, decimal)
Represents a single observed exchange rate on a specific calendar date for a series.
public RateObservation(DateOnly Date, decimal Rate)
Parameters
DateDateOnlyThe calendar date on which the rate was observed.
RatedecimalThe observed rate. Must be strictly positive when consumed by an RateSeries or RateSeriesBuilder; the type itself does not validate the value because it is also used as a transport record in scenarios that produce default instances.
Remarks
This type is a lightweight value carrier used by the series API in preference to repeated (DateOnly, decimal)
tuples. The surrounding series enforces the "strictly positive rate" and "unique date"
invariants; values constructed in isolation (including default(RateObservation)) carry no
validation guarantees.
Properties
Date
The calendar date on which the rate was observed.
public DateOnly Date { get; init; }
Property Value
Rate
The observed rate. Must be strictly positive when consumed by an RateSeries or RateSeriesBuilder; the type itself does not validate the value because it is also used as a transport record in scenarios that produce default instances.
public decimal Rate { get; init; }
Property Value
Methods
Deconstruct(out DateOnly, out decimal)
public void Deconstruct(out DateOnly Date, out decimal Rate)
Parameters
Equals(RateObservation)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(RateObservation other)
Parameters
otherRateObservationAn 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
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.
Operators
operator ==(RateObservation, RateObservation)
public static bool operator ==(RateObservation left, RateObservation right)
Parameters
leftRateObservationrightRateObservation
Returns
operator !=(RateObservation, RateObservation)
public static bool operator !=(RateObservation left, RateObservation right)
Parameters
leftRateObservationrightRateObservation
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |