I have a class that contains three local variables. I need to write a
method that updates one of these at a time based on a condition. I would
like to do this without writing a bunch of redundant code. For a very
simplified example:
private string x,y,z;
private void update(DayOfWeek d, int t)
{
switch(d)
{
case d.Monday:
switch (t)
{
case 1:
//update variable "x"
break;
case 2:
//update variable "y"
break;
}
case d.Tuesday:
switch (t)
{
case 1:
//update variable "x"
break;
case 2:
//update variable "y"
break;
}
// ...and so on for the remaining days of the week
}
}
I want to be able to simply call another method in order to eliminate
the nested switch block, but am unsure about how to go about this.
Can anybody help me? Thanks!
*** Sent via Developersdex http://www.developersdex.com ***