Tuesday, 21 April 2015

Difference between async void ,async Task and async Task methods

1)Task<T>returning async method can be awaited, and when the task completes it will return up a T.

2)Task returning async method can be awaited, and when the task completes, the continuation of the task is scheduled to run.

3)void returning async method cannot be awaited; it is a "fire and forget" method. It does work asynchronously, and you have no way of telling when it is done.


The await expression means "evaluate this expression to obtain an object representing work that will in future produce a result. Sign up the remainder of the current method as the call back associated with the continuation of that task. Once that task is produced and the call back is signed up,immediately return control to my caller". This is opposed/in contrast to a regular method call, which means "remember what you're doing, run this method until it is completely finished and then pick up where you left off, now knowing the result of the method".

For more, check this msdn link.

1 comment:

  1. Best Casino Apps of 2021 - Mapyro
    Best Casino Apps of 2021 · 10. PartyCasino · 남양주 출장샵 9. VegasSlots.io · 8. Sloto Cash. Play 광주 출장마사지 For Free. Big 188bet Dollar Casino · 7. 포항 출장마사지 Sloto Cash. Casino Bonus 동해 출장마사지 · 6. Sloto

    ReplyDelete