To Examples
WeekDaysEnum Example, source code file Program.cs
using System; ///
/// WeekDaysEnum Example, source code file Program.cs /// Show how to define and use an enum. /// An enum is a group of named int constants. ///
namespace WeekDaysEnum { public class Program { public static void Main() { WeekDays day = WeekDays.Wed; if (day == WeekDays.Sat || day == WeekDays.Sun) { Console.WriteLine("Is a weekend day."); } else { Console.WriteLine("Is not a weekend day."); } Console.WriteLine("Integer code for day is " + (int) day + "."); Console.ReadLine(); } } }
WeekDaysEnum Example, source code file WeekDaysEnum.cs
using System; ///
/// WeekDaysEnum Example, source code file WeekDaysEnum.cs /// Show how to define and use an enum. /// An enum is a group of named int constants. ///
namespace WeekDaysEnum { public enum WeekDays { Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7 } }