F
Frank
Hi,
In classic ASP with vbscript, I'd sometimes do this.
Select case true
case x = 3
code
case y = 6
code
case r = "tick"
code
End select
In C#, is there a way of doing such a thing? The current code I have that
is /not/ valid is this.
switch(true) {
case sPN!="":
something();
break;
case sPF!="":
//something else
break;
default:
//do something different
break;
}
I know that I could do a few nested ifs, but if there are 10 different
unrelated conditions I want to test for, it could get kinda messy.
Thanks,
Frank
In classic ASP with vbscript, I'd sometimes do this.
Select case true
case x = 3
code
case y = 6
code
case r = "tick"
code
End select
In C#, is there a way of doing such a thing? The current code I have that
is /not/ valid is this.
switch(true) {
case sPN!="":
something();
break;
case sPF!="":
//something else
break;
default:
//do something different
break;
}
I know that I could do a few nested ifs, but if there are 10 different
unrelated conditions I want to test for, it could get kinda messy.
Thanks,
Frank