CSharp · Console
using System;
using System.Threading.Tasks;
using System.Diagnostics;
var sw = Stopwatch.StartNew();
void Log(string msg) =>
Console.WriteLine($"[{sw.Elapsed.TotalSeconds:0.0}s] [thread {Environment.CurrentManagedThreadId}] {msg}");
void TestWait()
{
var t = Task.Factory.StartNew(async () =>
{
Console.WriteLine("Start");
await Task.Delay(5000);
Console.WriteLine("Done");
});
t.Wait();
Console.WriteLine("All done");
}
TestWait();