public decimal Value(Currency currency, IRateProvider rateProvider) { decimal amount = 0; foreach (var stock in _stockList) { var rate = rateProvider.Rate(stock.StockType, currency); amount += rate * stock.Value; } return(amount); }