RateRangeResult Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.dll
- Package
- Bodu.Financial 1.0.0
- Source
- RateRangeResult.cs
Represents the outcome of a range exchange-rate lookup: the observations that fall within the requested window, ordered by date, together with the metadata that describes the request and the span actually covered.
public sealed class RateRangeResult : IReadOnlyList<ExchangeRate>, IReadOnlyCollection<ExchangeRate>, IEnumerable<ExchangeRate>, IEnumerable
- Inheritance
-
RateRangeResult
- Implements
- Inherited Members
- Extension Methods
Remarks
The type implements IReadOnlyList<T> over its Rates, so it enumerates, indexes, and
composes with LINQ exactly like a plain sequence (foreach (var rate in result), result[0],
result.Where(...)) while still exposing the requested window through RequestedStartDate and
RequestedEndDate, and the observed span through FirstObservedDate and
LastObservedDate. Comparing the observed span to the requested window lets a caller see how much of
the window carried data without re-deriving it from the elements.
The range lookup does not apply a date-resolution policy and the per-observation provider and inversion flag are carried on each ExchangeRate, so no per-row resolution metadata is repeated here.
Constructors
RateRangeResult(string, string, DateOnly, DateOnly, IReadOnlyList<ExchangeRate>)
Initializes a new instance of the RateRangeResult class.
public RateRangeResult(string fromIsoCode, string toIsoCode, DateOnly requestedStartDate, DateOnly requestedEndDate, IReadOnlyList<ExchangeRate> rates)
Parameters
fromIsoCodestringThe requested source-currency ISO code.
toIsoCodestringThe requested destination-currency ISO code.
requestedStartDateDateOnlyThe inclusive start of the requested window.
requestedEndDateDateOnlyThe inclusive end of the requested window.
ratesIReadOnlyList<ExchangeRate>The observations within the window, ordered by date.
Exceptions
- ArgumentNullException
Thrown when
fromIsoCode,toIsoCode, orratesis null.
Properties
Count
Gets the number of observations in the range.
public int Count { get; }
Property Value
- int
The observation count.
FirstObservedDate
Gets the earliest observation date present in the range, or null when the range is empty.
public DateOnly? FirstObservedDate { get; }
Property Value
FromIsoCode
Gets the requested source-currency ISO code.
public string FromIsoCode { get; }
Property Value
- string
The source-currency ISO code.
IsEmpty
Gets a value indicating whether the range contains no observations.
public bool IsEmpty { get; }
Property Value
this[int]
Gets the observation at the specified index.
public ExchangeRate this[int index] { get; }
Parameters
indexintThe zero-based index.
Property Value
- ExchangeRate
The observation at
index.
LastObservedDate
Gets the latest observation date present in the range, or null when the range is empty.
public DateOnly? LastObservedDate { get; }
Property Value
Rates
Gets the observations within the window, ordered by date.
public IReadOnlyList<ExchangeRate> Rates { get; }
Property Value
- IReadOnlyList<ExchangeRate>
The rates in the range.
RequestedEndDate
Gets the inclusive end of the requested window.
public DateOnly RequestedEndDate { get; }
Property Value
- DateOnly
The requested end date.
RequestedStartDate
Gets the inclusive start of the requested window.
public DateOnly RequestedStartDate { get; }
Property Value
- DateOnly
The requested start date.
ToIsoCode
Gets the requested destination-currency ISO code.
public string ToIsoCode { get; }
Property Value
- string
The destination-currency ISO code.
Methods
GetEnumerator()
Returns an enumerator that iterates the observations in date order.
public IEnumerator<ExchangeRate> GetEnumerator()
Returns
- IEnumerator<ExchangeRate>
An enumerator over the observations.
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
IEnumerator IEnumerable.GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |