How to save the output of a console application

后端 未结 6 1127
有刺的猬
有刺的猬 2021-01-11 19:12

I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I w

6条回答
  •  走了就别回头了
    2021-01-11 20:03

    Consider refactoring your application to separate the user-interaction portions from the business logic. In my experience, such a separation is quite beneficial to the structure of your program.

    For the particular problem you're trying to solve here, it becomes straightforward for the user-interaction part to change its behavior from Console.WriteLine to file I/O.

提交回复
热议问题