sleep in csharp

Code Example - sleep in csharp

                
                        System.Threading.Thread.Sleep(50);
                    
                
 

csharp Sleep

                        
                                using System.Threading;

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

how to wait in csharp

                        
                                System.Threading.Thread.Sleep(Milliseconds);
                            
                        
 

csharp thread sleep

                        
                                Thread.Sleep(2000); //in ms
                            
                        
 

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
                            
                        
 

csharp sleep 1 second

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