Description
This issue is spread around a few sections, for example Process.StandardOutput:
The redirected
StandardOutput
stream can be read synchronously or asynchronously. Methods such asRead
,ReadLine
, andReadToEnd
perform synchronous read operations on the output stream of the process. These synchronous read operations do not complete until the associatedProcess
writes to itsStandardOutput
stream, or closes the stream.In contrast,
BeginOutputReadLine
starts asynchronous read operations on theStandardOutput
stream. This method enables a designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.
The description makes it sound like sync = Read
/ReadLine
and async = BeginOutputReadLine
/OutputDataReceived
where in fact the recommended async approach would surely be the task-based System.IO.StreamReader.ReadXAsync
(invoked on the supposedly "sync" StandardOutput
).