What is the most terse syntax to combine a check for some preconditions with a switch statement? Can I combine an if/else and switch statement?
if (!IsValid(text))
{
DoSomeLogging();
}
else
{
switch (text)
{
case "1":
DoSomething();
break;
case "2"
DoSomethingElse();
break;
default:
break;
}
}
Edit: Removed skip comment. I wasn't looking to invert the statement.