Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Console.ResetColor() Method in C#
The Console.ResetColor() method in C# is used to set the foreground and background console colors to their defaults.
Syntax
The syntax is as follows −
public static void ResetColor ();
Example
Let us now see an example to implement the Console.ResetColor() method in C# −
using System;
class Demo {
public static void Main (string[] args) {
Console.WriteLine ("At first, we have set colors here...\nAfter that, we will reset the colors to default.");
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("\nColors are set for this text");
Console.ResetColor();
Console.WriteLine ("\nNow we reset the color to default!");
}
}
Output
This will produce the following output −

Advertisements
