Beispiel #1
0
        static void Main()
        {
            // Create a "days" local variable.
            DaysOfTheWeek days = new DaysOfTheWeek();

            // Iterate each day in days and print to string.
            foreach (string day in days)
            {
                Console.Write(day + " ");
            }
            Console.ReadKey();
        }
Beispiel #2
0
        public static void Main()
        {
            Console.WriteLine("please enter the current day of the week.");


            string DaysOfTheWeek = Console.ReadLine();

            {
                try
                {
                    DaysOfTheWeek Friday = (DaysOfTheWeek)Enum.Parse(typeof(DaysOfTheWeek), DaysOfTheWeek);
                    Console.WriteLine(Friday);
                    Console.WriteLine("You entered:" + Friday);
                    Console.ReadLine();
                }
                catch
                {
                    Console.WriteLine("Please enter an actual day of the week.");
                    Console.ReadLine();
                }
            }
        }