sooqua sooqua - 1 year ago 81
C# Question

Why should I use AsyncCallback?

I've been using the

as a callback for my async method, and I just stumbled upon

I am wondering whether should I change the
? Would there be any difference?

Answer Source

AsyncCallback is an old delegate that is used when following the Begin / End async pattern with IAsyncResult.

Unless you are using IAsyncResult in your async code, then I wouldn't bother with it.

If you are using something that uses Begin / End, I would suggest using TaskFactory.FromAsync and converting it to an awaitable task.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download