34 lines
2.8 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<Type Name="DataReceivedEventHandler" FullName="System.Diagnostics.DataReceivedEventHandler">
<TypeSignature Language="C#" Value="public delegate void DataReceivedEventHandler(object sender, DataReceivedEventArgs e);" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed DataReceivedEventHandler extends System.MulticastDelegate" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters>
<Parameter Name="sender" Type="System.Object" />
<Parameter Name="e" Type="System.Diagnostics.DataReceivedEventArgs" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="sender">To be added.</param>
<param name="e">To be added.</param>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>When you create a <see cref="T:System.Diagnostics.DataReceivedEventHandler" /> delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see <format type="text/html"><a href="d98fd58b-fa4f-4598-8378-addf4355a115">Events and Delegates</a></format>.</para>
<para>To asynchronously collect the redirected <see cref="P:System.Diagnostics.Process.StandardOutput" /> or <see cref="P:System.Diagnostics.Process.StandardError" /> stream output of a process, add your event handler to the <see cref="E:System.Diagnostics.Process.OutputDataReceived" /> or <see cref="E:System.Diagnostics.Process.ErrorDataReceived" /> event. These events are raised each time the process writes a line to the corresponding redirected stream. When the redirected stream is closed, a null line is sent to the event handler. Ensure that your event handler checks for this condition before accessing the <see cref="P:System.Diagnostics.DataReceivedEventArgs.Data" /> property. For example, you can use the static method <see cref="M:System.String.IsNullOrEmpty(System.String)" /> to validate the <see cref="P:System.Diagnostics.DataReceivedEventArgs.Data" /> property in your event handler.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Represents the method that will handle the <see cref="E:System.Diagnostics.Process.OutputDataReceived" /> event or <see cref="E:System.Diagnostics.Process.ErrorDataReceived" /> event of a <see cref="T:System.Diagnostics.Process" />.</para>
</summary>
</Docs>
</Type>