System.Diagnostics.Process.OutputDataReceived Event

Occurs when an application writes to its redirected Process.StandardOutput stream.

Syntax

[System.ComponentModel.Browsable(true)]
[System.Diagnostics.MonitoringDescription("Raised when it receives output data")]
public event DataReceivedEventHandler OutputDataReceived

Remarks

The Process.OutputDataReceived event indicates that the associated System.Diagnostics.Process has written to its redirected Process.StandardOutput stream.

The event is enabled during asynchronous read operations on Process.StandardOutput. To start asynchronous read operations, you must redirect the Process.StandardOutput stream of a System.Diagnostics.Process, add your event handler to the Process.OutputDataReceived event, and call Process.BeginOutputReadLine. Thereafter, the Process.OutputDataReceived event signals each time the process writes a line to the redirected Process.StandardOutput stream, until the process exits or calls Process.CancelOutputRead.

Note:

The application that is processing the asynchronous output should call the Process.WaitForExit method to ensure that the output buffer has been flushed.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0