Enum type Day Counter - CSharp Custom Type

CSharp examples for Custom Type:Enum

Description

Enum type Day Counter

Demo Code

using System;//from w w  w  .j  av a 2 s  . c  o  m
enum Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}
public class SimpleDayCounter
{
   public static void Main()
   {
      Day currentDay = Day.Monday;
      int counter = 1;
      while (counter < 8)
      {
         Console.WriteLine(counter);
         if(currentDay == Day.Thursday)
            Console.WriteLine("\tIt's Thursday");
         if(currentDay == Day.Sunday)
            Console.WriteLine("\tIt's Sunday");
         counter++;
         currentDay++;
      }
   }
}

Result


Related Tutorials