locked
Async Await and AsyncCallback Difference RRS feed

  • Question

  • User-1961814522 posted

    Hi All,

    I am new to asynchronous programming. I understand Async Await and AsyncCallback (Delegates) are used to call methods asynchronously.

    I would like to know the real difference between the two. Can someone help me in understanding the difference.

    Thanks in advance,

    Ashvin

    Saturday, November 18, 2017 7:24 PM

All replies

  • User753101303 posted

    Hi,

    AFAIK the idea is to just make asynchronous programming easier. With async/await your code looks like synchronous code. With callbacks if you start for example to trigger another async operation from your callback, it will become quite soon hard to follow. Try to write the same code using both approach.

    Edit: you have a quick comparison at https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/ which also explicitely state that async/await is the recommended approach.

    Saturday, November 18, 2017 7:46 PM