Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# switch

// Generate a random value between 1 and 9
int caseSwitch = new Random().Next(1, 9);
switch (caseSwitch)
{
   case 1:
      Console.WriteLine("Case 1");
   break;
   case 2:
      Console.WriteLine("Case 2");
   break;
   case 3:
      Console.WriteLine("Case 3");
   break;
   default:
      Console.WriteLine("Value didn't match earlier.");
   break;
}
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #switch
ADD COMMENT
Topic
Name
2+4 =