Created
October 6, 2015 10:56
-
-
Save dkudelko/47956c00baa363fe06de to your computer and use it in GitHub Desktop.
async console applicatiion main
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CancellationTokenSource cts = new CancellationTokenSource(); | |
Console.CancelKeyPress += (s, e) => | |
{ | |
e.Cancel = true; | |
cts.Cancel(); | |
}; | |
MainAsync(args, cts.Token).Wait(); | |
} | |
static async Task MainAsync(string[] args, CancellationToken token) | |
{ | |
//todo paste your asnc code | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment