static void Main(string[] args)
 {
     foreach (LunchBreak type in Enum.GetValues(typeof(LunchBreak)))
     {
         LunchBreak LunchItem = type;
     }
 }
Ejemplo n.º 2
0
        public static Slot GetSlot(string category, string title, TimeSpan startTime, TimeSpan duration, TimeSpan defaultNetworkingEventStartTime)
        {
            if (string.IsNullOrWhiteSpace(category))
            {
                throw new ArgumentException(String.Empty, nameof(category));
            }

            if (string.IsNullOrWhiteSpace(title))
            {
                throw new ArgumentException(String.Empty, nameof(title));
            }

            Slot createdSlot = null;

            switch (category)
            {
            case "Session":
                createdSlot = new Session {
                    Duration = duration, StartTime = startTime, Title = title
                };
                break;

            case "Lunch Break":
                createdSlot = new LunchBreak(duration, startTime, title);
                break;

            case "Networking Session":
                createdSlot = new NetworkingEvent(defaultNetworkingEventStartTime, title);
                break;

            default:
                throw new ArgumentException($"Argument {category} is not valid.");
            }

            return(createdSlot);
        }