Answers for "console clear c#"

C#
2

c# clear console line

void Method()
{
	Console.WriteLine("Test");
	Console.SetCursorPosition(0, Console.CursorTop - 1);
	ClearCurrentConsoleLine();
}

public static void ClearCurrentConsoleLine()
{
    int currentLineCursor = Console.CursorTop;
    Console.SetCursorPosition(0, Console.CursorTop);
    Console.Write(new string(' ', Console.WindowWidth)); 
    Console.SetCursorPosition(0, currentLineCursor);
}
Posted by: Guest on July-18-2021
0

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;
   }
}
Posted by: Guest on October-26-2020
0

c# clear console read chache

while(Console.KeyAvailable) 
{
    Console.ReadKey(true);
}
Posted by: Guest on May-11-2020

C# Answers by Framework

Browse Popular Code Answers by Language