有没有办法让这些 foreach 循环只有一个lambda 表达式?
private int getNextEventId()
{
int numOfEvents = 0;
foreach (MonthModel eventMonth in eventsForAllMonths)
{
foreach (DayModel eventDay in eventMonth.AllDays)
{
numOfEvents += eventDay.CalEvents.Count;
}
}
return numOfEvents + 1;
}