예제 #1
0
파일: Program.cs 프로젝트: Cybr0/CSharp
        public static void OpenGates(TrafficLight.Lights light)
        {
            switch (light)
            {
            case TrafficLight.Lights.l_red:
            case TrafficLight.Lights.l_yellow:
                Console.WriteLine("Gates are closed");
                break;

            case TrafficLight.Lights.l_green:
                Console.WriteLine("Gates are opened");
                break;
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: Cybr0/CSharp
        public static void DrawTrafficLights(TrafficLight.Lights light)
        {
            var c_c = Console.ForegroundColor;

            switch (light)
            {
            case TrafficLight.Lights.l_red:
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("RED");
                break;

            case TrafficLight.Lights.l_yellow:
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("YELLOW");
                break;

            case TrafficLight.Lights.l_green:
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("GREEN");
                break;
            }
            Console.ForegroundColor = c_c;
        }