小编Dan*_*Dan的帖子

控制台颜色:同一行中是否有1个以上?

使用方法:

public static void ColoredConsoleWrite(ConsoleColor color, string text)
    {
    ConsoleColor originalColor = Console.ForegroundColor;
    Console.ForegroundColor = color;
    Console.Write(text);
    Console.ForegroundColor = originalColor;
}
Run Code Online (Sandbox Code Playgroud)

和:

ColoredConsoleWrite(ConsoleColor.Blue, $"My favorite fruit: Apple");

有没有一种方法可以使苹果保持红色,同时保留我最喜欢的水果:蓝色?

c# console

2
推荐指数
1
解决办法
2489
查看次数

标签 统计

c# ×1

console ×1