Using async code in a sync project (or learning async)

One of my favourite C# third party libraries is RestSharp. A while back they moved from a synchronous execution model to an asynchronous. Because I still haven’t quite got my head around how to do async code in C#, I find myself not continually updating RestSharp along with all my other third party libraries and keeping it at v16.

As soon as I type “await” in my code, the compiler starts making certain assumptions about the red tape around the calling routine, which is where I get profoundly lost. That is, things are now tasks and need to be managed as such.

Is there some article I can read, or video I can watch that will help me understand?

I recommend What are ASYNC and AWAIT in C#? Asynchronous Programming Tutorial - YouTube. It should help you grasp the idea behind async, but if you still feel confused by it, then microsoft has some great documentation on it at Asynchronous programming in C# | Microsoft Learn

A video I highly recommend is Asynchronous web applications by Steve Sanderson (who’s a fantastic speaker).

As for the compiler making assumptions, that is indeed something that will happen once you start using async/await: it is then async/await up until the top.