Here is a better example of what I want to do.
foreach (TimeEntry t in TimeEntries)
{
_Total += t.Duration;
switch (_Categories[t.CategoryId].CategoryType)
{
case 0:
_DirectTotal += t.Duration;
AddTime(ref DirectEntries, t);
switch (t.DateCreated.DayOfWeek)
{
case DayOfWeek.Friday:
_DirectFridayTotal += t.Duration;
break;
case DayOfWeek.Monday:
_DirectMondayTotal += t.Duration;
break;
case DayOfWeek.Saturday:
_DirectSaturdayTotal += t.Duration;
break;
// and so on for the reaminder of the week
default: break;
}
break;
case 1:
_IndirectTotal += t.Duration;
AddTime(ref IndirectEntries, t);
switch (t.DateCreated.DayOfWeek)
{
case DayOfWeek.Friday:
_IndirectFridayTotal += t.Duration;
break;
case DayOfWeek.Monday:
_IndirectMondayTotal += t.Duration;
break;
case DayOfWeek.Saturday:
_IndirectSaturdayTotal += t.Duration;
break;
// and so on for the reaminder of the week
default: break;
}
break;
}
}
I am trying to figure out a way to avoid all the nested switch blocks
and how to figure out which variable to update... thx!
*** Sent via Developersdex
http://www.developersdex.com ***