Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Mar 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

solved in NMoneys.Exchange v2.1.1.0

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

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant