dgg / nmoneys

.Net implementation of Money Value Object
BSD 3-Clause "New" or "Revised" License
76 stars 14 forks source link

Don't do ExchangeConversion if from and to currency codes are the same #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Just spotted that the ExchangeConversion class will instantiate a new Money 
even if the target currencyCode is the same as the source currencyCode.  Could 
this be optimized like this:

public Money To(CurrencyIsoCode to)
{
    if (_from.CurrencyCode == to)
        return _from;

    ExchangeRate rate = _provider.Get(_from.CurrencyCode, to);
    return rate.Apply(_from);
}

Original issue reported on code.google.com by peter.m....@gmail.com on 10 Sep 2012 at 8:29

GoogleCodeExporter commented 9 years ago
solved in NMoneys.Exchange v2.1.1.0

Original comment by danielgo...@gmail.com on 17 Mar 2013 at 9:26