Table of Contents

MoneyConversionResult<TSource, TTarget> Struct

Definition

Namespace
Bodu.Financial
Assembly
Bodu.Financial.dll
Package
Bodu.Financial 1.0.0
Source
MoneyConversionResult{T,T}.cs

Bundles the result of a single end-to-end strongly-typed money conversion together with the exchange-rate metadata that produced it, so consumers can audit which observed rate was used.

public readonly struct MoneyConversionResult<TSource, TTarget> : IEquatable<MoneyConversionResult<TSource, TTarget>> where TSource : ICurrency where TTarget : ICurrency

Type Parameters

TSource

The source currency.

TTarget

The destination currency.

Implements
Inherited Members
Extension Methods

Constructors

MoneyConversionResult(Money<TSource>, Money<TTarget>, RateLookupResult)

Bundles the result of a single end-to-end strongly-typed money conversion together with the exchange-rate metadata that produced it, so consumers can audit which observed rate was used.

public MoneyConversionResult(Money<TSource> SourceAmount, Money<TTarget> TargetAmount, RateLookupResult ExchangeRate)

Parameters

SourceAmount Money<TSource>

The original source amount.

TargetAmount Money<TTarget>

The converted, rounded target amount.

ExchangeRate RateLookupResult

The full lookup result, including provider, dates, and inversion flag, used to compute TargetAmount.

Properties

ExchangeRate

The full lookup result, including provider, dates, and inversion flag, used to compute TargetAmount.

public RateLookupResult ExchangeRate { get; init; }

Property Value

RateLookupResult

SourceAmount

The original source amount.

public Money<TSource> SourceAmount { get; init; }

Property Value

Money<TSource>

TargetAmount

The converted, rounded target amount.

public Money<TTarget> TargetAmount { get; init; }

Property Value

Money<TTarget>

Methods

Deconstruct(out Money<TSource>, out Money<TTarget>, out RateLookupResult)

public void Deconstruct(out Money<TSource> SourceAmount, out Money<TTarget> TargetAmount, out RateLookupResult ExchangeRate)

Parameters

SourceAmount Money<TSource>
TargetAmount Money<TTarget>
ExchangeRate RateLookupResult

Equals(MoneyConversionResult<TSource, TTarget>)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(MoneyConversionResult<TSource, TTarget> other)

Parameters

other MoneyConversionResult<TSource, TTarget>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

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 ==(MoneyConversionResult<TSource, TTarget>, MoneyConversionResult<TSource, TTarget>)

public static bool operator ==(MoneyConversionResult<TSource, TTarget> left, MoneyConversionResult<TSource, TTarget> right)

Parameters

left MoneyConversionResult<TSource, TTarget>
right MoneyConversionResult<TSource, TTarget>

Returns

bool

operator !=(MoneyConversionResult<TSource, TTarget>, MoneyConversionResult<TSource, TTarget>)

public static bool operator !=(MoneyConversionResult<TSource, TTarget> left, MoneyConversionResult<TSource, TTarget> right)

Parameters

left MoneyConversionResult<TSource, TTarget>
right MoneyConversionResult<TSource, TTarget>

Returns

bool

Applies to

ProductVersions
.NET8, 10