Read values already printed to the console

后端 未结 4 1376
灰色年华
灰色年华 2021-01-18 12:32

This may be completely impossible, but I was wondering if there is a way to read values that the console has already printed. For example, if the console printed

4条回答
  •  一向
    一向 (楼主)
    2021-01-18 12:57

    It's generally a bad idea to read values from the console unless it is user input. You should put the value into a variable, or if you need to read it at a later date, save it to a file.

    String a = "You are travelling north at a speed of 10m/s"
    Console.WriteLine(a);
    //Do anything you want with variable 'a'
    

提交回复
热议问题