c# wait for a task to finish code example Example: how to wait in c# System.Threading.Thread.Sleep(Milliseconds);