Redirect console.writeline from windows application to a string

前端 未结 4 1800
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 08:29

I have an external dll written in C# and I studied from the assemblies documentation that it writes its debug messages to the Console using Console.WriteLine.

4条回答
  •  暖寄归人
    2020-11-28 08:43

    You can also call SetOut with Console.OpenStandardOutput, this will restore the original output stream:

    Console.SetOut(new StreamWriter(Console.OpenStandardOutput()));
    

提交回复
热议问题