SIFWorks ADK 2.0
AsyncUtils Class
NamespacesEdustructures.UtilAsyncUtils

[This is preliminary documentation and is subject to change.]

This class allows you to safely invoke a delegate asynchronously, similarly to calling BeginInvoke(), without ever having to call EndInvoke(). Simply call AsyncHelper.QueueTaskToThreadPool()
Declaration Syntax
C#Visual BasicVisual C++
public class AsyncUtils
Public Class AsyncUtils
public ref class AsyncUtils
Members
All MembersConstructorsMethods



IconMemberDescription
AsyncUtilsAsyncUtilsNew()()
static memberQueueTaskToThreadPool(Delegate, array<Object>[]())
This method allows you to safely invoke a delegate asynchronously, similarly to calling BeginInvoke(), without ever having to call EndInvoke().

Remarks

Starting with the 1.1 release of the .NET Framework, the SDK docs now carry a caution that mandates calling EndInvoke on delegates you've called BeginInvoke on in order to avoid potential leaks. This means you cannot simply "fire-and-forget" a call to BeginInvoke without the risk of running the risk of causing problems.

Examples
For example, assuming a delegate defined as follows:
CopyC#
delegate void CalcAndDisplaySumDelegate( int a, int b );
Instead of doing this to fire-and-forget an async call to some target method:
CopyC#
CalcAndDisplaySumDelegate d = new CalcAndDisplaySumDelegate(someCalc.Add);
d.BeginInvoke(2, 3, null);
You would instead do this:
CopyC#
CalcAndDisplaySumDelegate d = new CalcAndDisplaySumDelegate(someCalc.Add);
AsyncHelper.QueueTaskToThreadPool(d, 2, 3);

This code was created from a sample by Mike Woodring( http://staff.develop.com/woodring )

Inheritance Hierarchy
Object
AsyncUtils

Assembly: Edustructures.SifWorks.Adk (Module: Edustructures.SifWorks.Adk) Version: 2.0.0.10