6
Answers

Console.Clear();

Maha

Maha

11y
4.3k
1
I wish to know the function of Console.Clear();. I have usual black colour console window. If Console.Clear(); was comment out output was blue colour XXXXX in black colour console window.

If Console.Clear(); was uncommented output was only yellow colour Console window no XXXXX at all.

using System;

class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Blue;

Console.WriteLine("XXXXX");

Console.BackgroundColor = ConsoleColor.Yellow;

Console.Clear();

Console.ReadKey();
}
}

Answers (6)