Does this VB6 code have a way of doing this in C#?
Case "01" To "04" :
Thanks ahead of time.
aar
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.
VulpesPosted Jun 8, 2011, 1:03 PM
Jiteendra SampathiraoPosted Jun 8, 2011, 12:55 PM
If you r looking for switch case in c#:
string myInput;
int myInt;
begin:
Console.Write("Please enter a number between 1 and 3: ");
myInput = Console.ReadLine();
myInt = Int32.Parse(myInput);
// switch with integer type
switch (myInt)
{
case 1:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 2:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 3:
Console.WriteLine("Your number is {0}.", myInt);
break;
default:
Console.WriteLine("Your number {0} is not between 1 and 3.", myInt);
break;
Roy SPosted Jun 8, 2011, 12:52 PM
switch (var)
{
case "01":
case "02":
case "03":
case "04":
DoStuff();
break;
default:
break;
}