c# clear console code example
Example 1: how to clear console in c#
Console.Clear();
Example 2: c# console clear
using System;
using System.Collections.Generic;
class Program {
static void Main() {
ConsoleColor foreColor = Console.ForegroundColor;
ConsoleColor backColor = Console.BackgroundColor;
Console.WriteLine("Clearing the screen!");
Console.Clear();
ConsoleColor newForeColor = ConsoleColor.Blue;
ConsoleColor newBackColor = ConsoleColor.Yellow;
}
}
Example 3: c# clear console read chache
while(Console.KeyAvailable)
{
Console.ReadKey(true);
}