C# में Console.ResetColor() विधि का उपयोग अग्रभूमि और पृष्ठभूमि कंसोल रंगों को उनके डिफ़ॉल्ट पर सेट करने के लिए किया जाता है।
सिंटैक्स
वाक्य रचना इस प्रकार है -
public static void ResetColor ();
उदाहरण
आइए अब C# -
. में Console.ResetColor() विधि को लागू करने के लिए एक उदाहरण देखें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!");
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
