Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
74 lines (67 sloc) 5.25 KB
<Type Name="AsyncCallback" FullName="System.AsyncCallback">
<TypeSignature Language="C#" Value="public delegate void AsyncCallback(IAsyncResult ar);" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed AsyncCallback extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.AsyncCallback" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub AsyncCallback(ar As IAsyncResult)" />
<TypeSignature Language="C++ CLI" Value="public delegate void AsyncCallback(IAsyncResult ^ ar);" />
<TypeSignature Language="F#" Value="type AsyncCallback = delegate of IAsyncResult -&gt; unit" />
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="ar" Type="System.IAsyncResult" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="ar">The result of the asynchronous operation.</param>
<summary>References a method to be called when a corresponding asynchronous operation completes.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use an <xref:System.AsyncCallback> delegate to process the results of an asynchronous operation in a separate thread. The <xref:System.AsyncCallback> delegate represents a callback method that is called when the asynchronous operation completes. The callback method takes an <xref:System.IAsyncResult> parameter, which is subsequently used to obtain the results of the asynchronous operation.
For more information about asynchronous programming, see [Using an AsyncCallback Delegate to End an Asynchronous Operation](~/docs/standard/asynchronous-programming-patterns/using-an-asynccallback-delegate-to-end-an-asynchronous-operation.md) and [Using an AsyncCallback Delegate and State Object](~/docs/standard/asynchronous-programming-patterns/using-an-asynccallback-delegate-and-state-object.md) in [Event-based Asynchronous Pattern (EAP)](~/docs/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-eap.md).
## Examples
The following code example demonstrates using asynchronous methods in the <xref:System.Net.Dns> class to retrieve Domain Name System (DNS) information for user-specified computers. This example creates an <xref:System.AsyncCallback> delegate that references the `ProcessDnsInformation` method. This method is called once for each asynchronous request for DNS information.
[!code-csharp[AsyncDesignPattern#4](~/samples/snippets/csharp/VS_Snippets_CLR/AsyncDesignPattern/CS/AsyncDelegateNoStateObject.cs#4)]
[!code-vb[AsyncDesignPattern#4](~/samples/snippets/visualbasic/VS_Snippets_CLR/AsyncDesignPattern/VB/AsyncDelegateNoState.vb#4)]
]]></format>
</remarks>
<altmember cref="T:System.IAsyncResult" />
<related type="Article" href="https://msdn.microsoft.com/library/9d97206c-8917-406c-8961-7d0909d84eeb">Using an AsyncCallback Delegate to End an Asynchronous Operation</related>
<related type="Article" href="https://msdn.microsoft.com/library/e3e5475d-c5e9-43f0-928e-d18df8ca1f1d">Using an AsyncCallback Delegate and State Object</related>
<related type="Article" href="https://msdn.microsoft.com/library/41972034-92ed-450a-9664-ab93fcc6f1fb">Calling Synchronous Methods Asynchronously</related>
<related type="Article" href="https://msdn.microsoft.com/library/c6baed9f-2a25-4728-9a9a-53b7b14840cf">Event-based Asynchronous Pattern (EAP)</related>
<related type="Article" href="https://msdn.microsoft.com/library/b6f65241-e0ad-4590-a99f-200ce741bb1f">Handling and Raising Events</related>
</Docs>
</Type>
You can’t perform that action at this time.