Console.Clear Method in C# Last Updated : 29 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report This method is used to clear the console buffer and corresponding console window of display information. Syntax: public static void Clear (); Exceptions: This method throws IOException if an I/O error occurred. Below programs show the use of Console.Clear() method: Program 1: To display the contents before the use of Clear method csharp // C# program to illustrate the use // of Console.Clear Method using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace GFG { class Program { static void Main(string[] args) { // Print the statements Console.WriteLine("GeeksForGeeks"); Console.WriteLine("A Computer Science Portal"); Console.WriteLine("For Geeks"); } } } Output: GeeksForGeeks A Computer Science Portal For Geeks Program 2: Use clear() method to clear the console csharp // C# program to illustrate the use // of Console.Clear Method using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace GFG { class Program { static void Main(string[] args) { // Print the statements Console.WriteLine("GeeksForGeeks"); Console.WriteLine("A Computer Science Portal"); Console.WriteLine("For Geeks"); // Clear the Console Console.Clear(); } } } Output: Comment More infoAdvertise with us Next Article C# | Dictionary.Clear Method K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Console-Class Similar Reads Console.SetOut() Method in C# Console.SetOut(TextWriter) Method in C# is used to redirect the stream of standard output. With the help of this method, a user can specify a StreamWriter as the output object. The Console.SetOut method will receive an object of type TextWriter. The StreamWriter can be passed to Console.SetOut and i 2 min read Console.ReadKey() Method in C# Console.ReadKey() Method makes the program wait for a key press and it prevents the screen until a key is pressed. In short, it obtains the next character or any key pressed by the user. The pressed key is displayed in the console window(if any input process will happen). There are two methods in th 5 min read C# | Dictionary.Clear Method This method is used to remove all key/value pairs from the Dictionary<TKey,TValue>. Syntax: public void Clear (); Below are the programs to illustrate the use of above-discussed method: Example 1: csharp // C# code to remove all pairs // from Dictionary using System; using System.Collections.G 2 min read Console.ReadLine() Method in C# This method is used to read the next line of characters from the standard input stream. It comes under the Console class(System Namespace). If the standard input device is the keyboard, the ReadLine method blocks until the user presses the Enter key. And if standard input is redirected to a file, th 2 min read Stack.Clear Method in C# This method(comes under System.Collections namespace) is used to remove all the objects from the Stack. This method will set the Count of Stack to zero, and references to other objects from elements of the collection are also removed. This method is an O(n) operation, where n is Count. Syntax: publi 2 min read Queue.Clear Method in C# This method is used to remove the objects from the Queue. This method is an O(n) operation, where n is the total count of elements. And this method comes under System.Collections namespace. Syntax: public void Clear (); Below given are some examples to understand the implementation in a better way: 2 min read Like