Created
April 24, 2019 07:40
-
-
Save Protiguous/aed9820d81c85dd0d49a46d8accc1c82 to your computer and use it in GitHub Desktop.
Having fun with awaiting on forms.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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