Technology

Call a CallBack method when asynchronously Call completes in Asp.net Part IV

In Previous articles, we established a result that one delegate function which wrapped a function to call asynchronously. Now there will be another asynchronous function which calls when asynchronous function completes its execution just like another asynchronous function. In Callback function you can process result or call EndInvoke methods or any other action to perform after asynchronous call.

In this pattern, you must pass the callback delegate to BeginInvoke as a parameter. Thread initiates the asynchronous call but doesn’t wait like other pattern. After asynchronous call complete, it calls Callback function to process result and call endInvoke function. Let’s see an example.

CallbackPattern

Result:

CallbackPatternResult

Download (RAR, 577B)

Author

Hassan Askari