Skip to content

Instantly share code, notes, and snippets.

@Protiguous
Created April 24, 2019 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Protiguous/aed9820d81c85dd0d49a46d8accc1c82 to your computer and use it in GitHub Desktop.
Save Protiguous/aed9820d81c85dd0d49a46d8accc1c82 to your computer and use it in GitHub Desktop.
Having fun with awaiting on forms.
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
using Forms;
public static class Program {
[STAThread]
public static async Task Main() {
var task1 = Task.Run( () => {
using ( var form = new MainForm() ) {
Application.Run( form );
}
} );
var task2 = Task.Run( () => {
using ( var form = new MainForm() ) {
Application.Run( form );
}
} );
await task1.ConfigureAwait( false );
await task2.ConfigureAwait( false );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment