Last active
February 27, 2019 14:26
-
-
Save felipeslongo/5eb5bc52c5ad49b00b872238fa248e5f to your computer and use it in GitHub Desktop.
Fire and Forge: How it changes the way the caller works
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
static void async Main(string[] args) | |
{ | |
await FireAndForget(); | |
Console.WriteLine("Caller"); | |
FireAndForget(); | |
Console.WriteLine("Caller"); | |
} | |
public static async Task FireAndForget() | |
{ | |
Console.WriteLine("Begin FireAndForget"); | |
await Task.Delay(TimeSpan.FromSeconds(5)); | |
Console.WriteLine("End FireAndForget"); | |
} | |
//Output: | |
//Begin FireAndForget | |
//End FireAndForget | |
//Caller | |
//Output: | |
//Begin FireAndForget | |
//Caller | |
//End FireAndForget |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment