Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions xml/System.ComponentModel/RunWorkerCompletedEventArgs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
<format type="text/markdown"><![CDATA[

## Remarks
If you are using a class that implements the [Event-based Asynchronous Pattern Overview](~/docs/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview.md), the class provides a *MethodName*`Completed` event. *MethodName* is a placeholder for the first part of the method's name. <xref:System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted%2A?displayProperty=nameWithType> is an example of the name of such a method. If you add an instance of the <xref:System.ComponentModel.RunWorkerCompletedEventArgs> delegate to the event, you will receive information about the outcome of asynchronous operations in the <xref:System.ComponentModel.RunWorkerCompletedEventArgs> parameter of the corresponding event handler.

When using the [event-based asynchronous pattern](~/docs/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-eap.md) for asynchronous operations, a Windows Forms form or control initiates an asyncronous operation by calling the <xref:System.ComponentModel.BackgroundWorker.RunWorkerAsync%2A?displayProperty=nameWithType> method. The method in turn raises the <xref:System.ComponentModel.BackgroundWorker.DoWork?displayProperty=nameWithType> event asynchronously and passes it a <xref:System.ComponentModel.DoWorkEventArgs> instance. If the asychronous operation returns a value, the <xref:System.ComponentModel.BackgroundWorker.DoWork?displayProperty=nameWithType> event handler typically assigns it to the <xref:System.ComponentModel.DoWorkEventArgs.Result?displayProperty=nameWithType> property. When the asynchronous operation completes, the <xref:System.ComponentModel.BackgroundWorker.RunWorkerCompleted?displayProperty=nameWithType> event is raised and is passed a <xref:System.ComponentModel.RunWorkerCompletedEventArgs> instance that contains information about the status of the operation (whether it was cancelled, faulted, or completed successfully). If it completed successfully, its <xref:System.ComponentModel.RunWorkerCompletedEventArgs.Result> property contains the value returned by the asynchronous operation and previously assigned to the <xref:System.ComponentModel.DoWorkEventArgs.Result?displayProperty=nameWithType> property.

> [!NOTE]
> The <xref:System.Security.Permissions.HostProtectionAttribute> attribute applied to this class has the following <xref:System.Security.Permissions.HostProtectionAttribute.Resources%2A> property value: <xref:System.Security.Permissions.HostProtectionResource.SharedState>. The <xref:System.Security.Permissions.HostProtectionAttribute> does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the <xref:System.Security.Permissions.HostProtectionAttribute> class or [SQL Server Programming and Host Protection Attributes](~/docs/framework/performance/sql-server-programming-and-host-protection-attributes.md).



## Examples
The following code example illustrates the use of <xref:System.ComponentModel.RunWorkerCompletedEventArgs>. This example is part of a larger sample for the <xref:System.ComponentModel.BackgroundWorker> class.

Expand Down