It would be great to have shorthand for processing every item in a list, in this case saving.
SO intead of
var people = MakePeople();
foreach (var person in people)
{
session.Save(person);
}
we could use
var cards = MakeCards(deck);
cards.Select(session.Save);
But, that doesn’t work.. Suggestions? Aggregate?
Selectuses lazy evaluation, so it won’t work.You’re looking for
List<T>.ForEach, or its non-existent LINQ version.