Async/await in console app

// PM> Install-Package Nito.AsyncEx

using Nito.AsyncEx;

class Program {
static void Main(string[] args) {
AsyncContext.Run(() => MainAsync(args));

static async void MainAsync(string[] args) {
// await Something...

This was an answer on StackOverflow by async/await superstar and blogger Stephen Cleary, who wrote the referenced NuGet package.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s