I know this is possible in Visual Basic. But is something like that possible in c#?
string a = "two"
switch(a)
{
case "one", "two":
DoSomeThing();
break;
}
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Mar 9, 2011, 2:43 AM
Per JespersenPosted Mar 9, 2011, 2:32 AM
Sam HobbsPosted Mar 6, 2011, 7:29 PM
Hirendra SisodiyaPosted Mar 6, 2011, 4:28 AM
string a = "One";
if (a == "One")
{
DoSomeThing();
}
else if (a == "Two")
{
DoSomeThing();
}
VulpesPosted Mar 4, 2011, 6:39 PM
If the cases are not empty, then you have to use 'goto case' if you want to jump to another case:
Raja KrishnamurthyPosted Mar 4, 2011, 3:52 PM