csharp sleep 1 second

Code Example - csharp sleep 1 second

                
                        using System.Threading;
Thread.Sleep(1000);
                    
                
 

csharp Sleep

                        
                                using System.Threading;

static void Main()
{
  //do stuff
  Thread.Sleep(5000) //will sleep for 5 sec
}
                            
                        
 

csharp thread sleep

                        
                                Thread.Sleep(2000); //in ms
                            
                        
 

sleep in csharp

                        
                                System.Threading.Thread.Sleep(50);
                            
                        
 

csharp wait seconds

                        
                                //wait 2 seconds
Thread.Sleep(2000);
Task.Delay(2000);

//Both are valid options but Task.Delay() can be used with the async keyword