protected override Task ProcessOutputValueAsync(int input, FizzBuzzFlag flags)
        {
            var previousForeGroundColor = Console.ForegroundColor;

            switch (flags)
            {
            case FizzBuzzFlag.Fizz:
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("Fizz");
                break;

            case FizzBuzzFlag.Buzz:
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Buzz");
                break;

            case FizzBuzzFlag.FizzBuzz:
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("FizzBuzz");
                break;

            default:
                Console.WriteLine(input);
                break;
            }

            Console.ForegroundColor = previousForeGroundColor;
            return(Task.CompletedTask);
        }
示例#2
0
 protected virtual Task ProcessOutputValueAsync(int input, FizzBuzzFlag flags)
 {
     Debug.Write($"{input} ({flags})");
     return(Task.CompletedTask);
 }