Thursday, April 19, 2012

How do I convert this double foreach loop to just lambdas?

Is this there a way to these foreach loops just one lambda expression?



    private int getNextEventId()
{
int numOfEvents = 0;

foreach (MonthModel eventMonth in eventsForAllMonths)
{
foreach (DayModel eventDay in eventMonth.AllDays)
{
numOfEvents += eventDay.CalEvents.Count;
}
}

return numOfEvents + 1;
}




No comments:

Post a Comment