public SummingDictionary <double> GetTallies() { SummingDictionary <double> tallies = new SummingDictionary <double>(); foreach (var cashflow in cashflows) { tallies.Add(cashflow.years, cashflow.amount); } return(tallies); }
public double WAL() { SummingDictionary <double> tallies = GetTallies(); double num = 0; double den = 0; foreach (var tally in tallies) { if (tally.Value > 0) { num += tally.Key * tally.Value; den += tally.Value; } } return(num / den); }