เมธอด Console.ResetColor() ใน C# ใช้สำหรับตั้งค่าสีพื้นหลังและสีพื้นหน้าของคอนโซลกลับเป็นค่าเริ่มต้น
ไวยากรณ์
public static void 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!");
}
}ผลลัพธ์
