Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Evento Process.ErrorDataReceived

 

Publicado: noviembre de 2016

Se produce cuando una aplicación escribe en su secuencia redirigida de StandardError.

Espacio de nombres:   System.Diagnostics
Ensamblado:  System (en System.dll)

[<BrowsableAttribute(true)>]
member ErrorDataReceived : IEvent<DataReceivedEventHandler,
    DataReceivedEventArgs>

The E:System.Diagnostics.Process.ErrorDataReceived event indicates that the associated process has written to its redirected P:System.Diagnostics.Process.StandardError stream.

The event only occurs during asynchronous read operations on P:System.Diagnostics.Process.StandardError. To start asynchronous read operations, you must redirect the P:System.Diagnostics.Process.StandardError stream of a T:System.Diagnostics.Process, add your event handler to the E:System.Diagnostics.Process.ErrorDataReceived event, and call M:System.Diagnostics.Process.BeginErrorReadLine. Thereafter, the E:System.Diagnostics.Process.ErrorDataReceived event signals each time the process writes a line to the redirected P:System.Diagnostics.Process.StandardError stream, until the process exits or calls M:System.Diagnostics.Process.CancelErrorRead.

System_CAPS_noteNota

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

The following example uses the net view command to list the available network resources on a remote computer. The user supplies the target computer name as a command-line argument. The user can also supply a file name for error output. The example collects the output of the net command, waits for the process to finish, and then writes the output results to the console. If the user supplies the optional error file, the example writes errors to the file.

No hay ningún ejemplo de código disponible o este idioma no es compatible.

LinkDemand

for full trust for the immediate caller. This member cannot be used by partially trusted code.

.NET Framework
Disponible desde 2.0
Volver al principio
Mostrar: