Free mag vol1 | Page 184

CHAPTER 3  CORE C# PROGRAMMING CONSTRUCTS, PART I favDay = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), Console.ReadLine()); } catch (Exception) { Console.WriteLine("Bad input!"); return; } } switch (favDay) { case DayOfWeek.Friday: Console.WriteLine("Yes, Friday rules!"); break; case DayOfWeek.Monday: Console.WriteLine("Another day, another dollar"); break; case DayOfWeek.Saturday: Console.WriteLine("Great day indeed."); break; case DayOfWeek.Sunday: Console.WriteLine("Football!!"); break; case DayOfWeek.Thursday: Console.WriteLine("Almost Friday..."); break; case DayOfWeek.Tuesday: Console.WriteLine("At least it is not Monday"); break; case DayOfWeek.Wednesday: Console.WriteLine("A fine day."); break; }  Source Code The IterationsAndDecisions project is located under the Chapter 3 subdirectory. Summary The goal of this chapter was to expose you to numerous core aspects of the C# programming language. Here, we examined the commonplace constructs in any application you may be interested in building. After examining the role of an application object, you learned that every C# executable program must have a type defining a Main() method, which serves as the program’s entry point. Within the scope of Main(), you typically create any number of objects that work together to breathe life into your application. Next, we dove into the details of the built-in data types of C# and came to understand that each data type keyword (e.g., int) is really a shorthand notation for a full-blown type in the System namespace (System.Int32, in this case). Given this, each C# data type has a number of built-in members. Along the 118