我正在使用Process类来启动一些进程,它正在计算一些数据并在它的控制台上提供输出,我需要阅读进程控制台的最后一行。应该怎么做?它与process.BeginOutputReadLine();但我不知道如何用于只读最后一行。
string lastLine = null;
while (!process.StandardOutput.EndOfStream)
{
lastLine = process.StandardOutput.ReadLine();
}
//do what you want here with lastLine;
Run Code Online (Sandbox Code Playgroud)