Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# switch

switch (caseSwitch)
{
   case 1:
      Console.WriteLine("Case 1");
      DateTime date = DateTime.Today;
      Console.WriteLine("Today's date is {0}", date);
      if (date.Day == 2)
      {
         Console.WriteLine("This is the shortest month");
      }
   break;
   case 2:
      Console.WriteLine("Case 2");
   break;
   case 3:
      Console.WriteLine("Case 3");
   break;
   default:
      Console.WriteLine("Default case");
   break;
}
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #switch
ADD COMMENT
Topic
Name
5+2 =