Skip to content

Instantly share code, notes, and snippets.

@adams85
Created September 22, 2018 20:24
Show Gist options
  • Save adams85/4c59deedc1a1f4f48a3ece52a2a9e3d9 to your computer and use it in GitHub Desktop.
Save adams85/4c59deedc1a1f4f48a3ece52a2a9e3d9 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace netcore
{
class Program
{
static async Task TestAsync()
{
// this task or ConfigureAwait(false) affects nothing as long as awaited
await Task.Run(() => Console.WriteLine("First task run")).ConfigureAwait(false);
var task = Task.Run(() => Thread.Sleep(5000));
await task.ContinueWith(t => Console.WriteLine("Continuation fired"));
Console.WriteLine("Done");
}
static void Main(string[] args)
{
var _ = TestAsync();
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment