Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# switch

// switch..case with enum
void WeekEndOrWeekDay()
{
   switch (DateTime.Now.DayOfWeek)
   {
   case DayOfWeek.Saturday:
   case DayOfWeek.Sunday:
      Console.WriteLine("Today is Weekend");
   break;
   default:
      Console.WriteLine("Today is a work day.");
   break;
   }
}
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #switch
ADD COMMENT
Topic
Name
5+3 =