static void Main(string[] args)
        {
            ConsolePlate cp = new ConsolePlate();

            ConsolePlate[] somePlates =
            { new ConsolePlate('*', ConsoleColor.Red), cp, new ConsolePlate((char)12, ConsoleColor.Green) };

            foreach (ConsolePlate conPl in somePlates)
            {
                Console.ForegroundColor = conPl.PlateColor;
                Console.Write(conPl.PlateChar);
            }
            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ConsolePlate x = new ConsolePlate('X', ConsoleColor.Red, ConsoleColor.White);
            ConsolePlate o = new ConsolePlate('O', ConsoleColor.Magenta, ConsoleColor.White);
            int          n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; ++i, Console.WriteLine())
            {
                for (int j = 0; j < n; ++j)
                {
                    ConsolePlate t = (i + j) % 2 == 0 ? x : o;
                    Console.BackgroundColor = t.PlateColorBackground;
                    Console.ForegroundColor = t.PlateColorForeground;
                    Console.Write(t.PlateChar);
                }
            }
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            ConsolePlate[] arr = new ConsolePlate[n];

            int min = 0; int max = 100;

            for (int i = 0; i < arr.GetLength(0); i++)
            {
                arr[i] = new ConsolePlate((char)Random.Next(min, max),
                                          ConsolePlates[Random.Next(0, ConsolePlates.Length)]);
            }

            foreach (ConsolePlate a in arr)
            {
                Console.BackgroundColor = a.PlateColor;
                Console.WriteLine(a.PlateChar);
            }

            Console.ReadKey();
        }