Lambda Expression

c#, lambda

Solution

Honestly, it looks pretty clear to me. I think that a lambda in this case may be less readable, i.e., something like Brandon posted below.

(Stolen from Brandon's post)

var project = accounts.Select(a => a.AccountProjects)
                      .Where(x => x.AccountProjectID == accountProjectId);

As far as readability is concerned, I think that a couple of loops is preferable to the lambda solution, and I think that your solution is preferable to the loops.

Problem

Can I simplify this statement with a lambda expression? ``` var project = from a in accounts from ap in a.AccountProjects where ap.AccountProjectID == accountProjectId select ap; ```

Original source