I have the following method containing a simple foreach loop in a C# class. The method returns the sum of totals calculated using a function on a separate class.
private readonly ICalculateTotalService _calculateTotalService;
public decimal GetTotal(IOrder order)
{
decimal paidTotal = 0;
foreach (var line in order.Lines)
{
paidTotal += _calculateTotalService.GetTotal(line);
}
return paidTotal;
}
Resharper is suggesting that this can be refactored into a LINQ statement. What would the best way be to go about doing this?