What is more readable?

c#, lambda, linq, readability

Solution

If the team that works on the code knows what the Linq version does and knows its inner workings, then it is more readable.

Problem

I have these two pieces of code, wich one is more readable? foreach ``` decimal technicalPremium = 0; foreach (Risk risk in risks) { technicalPremium = technicalPremium + risk.TechnicalPremium; } return technicalPremium; ``` linq ``` return risks.Sum(risk => risk.TechnicalPremium); ```

Original source

Related problems