更新时间:2023-12-05 13:12:28
那么您可以使用 Console.SetOut
到 TextWriter
的实现,该实现不会在任何地方编写:
Well you can use Console.SetOut
to an implementation of TextWriter
which doesn't write anywhere:
Console.SetOut(TextWriter.Null);
这会抑制所有 all 控制台输出。您始终可以维护对原始 Console.Out
编写器的引用,并将其用于自己的输出。
That will suppress all console output though. You could always maintain a reference to the original Console.Out
writer and use that for your own output.