static void Main(string[] args) { for (int i = 0; i < 100; i++) { Console.BackgroundColor = Styling.Instance().BackgroundColor; Console.ForegroundColor = Styling.Instance().ConsoleColor; Console.WriteLine("Hello World!"); } }
public static Styling Instance() { if (styling == null) { lock (TrafficLight) { if (styling == null) { styling = new Styling(ConsoleColor.Red, ConsoleColor.Blue); } } } return(styling); }