Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# async sleep

// Async
await Task.Delay(1000); //when you want a logical delay without blocking the current thread
// Not Async
Thread.Sleep(1000) //when you want to block the current thread.
Comment

c# async sleep


private async void Button_Click_1(object sender, RoutedEventArgs e)
{
    label1.Text = "Test";
    await Task.Delay(2000);
    label1.Text = "";
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: loop through an enum c# 
Csharp :: open scene unity 
Csharp :: use enter key unity 
Csharp :: unity how to convert to byte 
Csharp :: make winforms full-screen c# 
Csharp :: unity get layer of gameobject 
Csharp :: vue.createapp is not a function 
Csharp :: unity check if number is multiple of x 
Csharp :: OnInitialized blazor 
Csharp :: c# string to memorystream 
Csharp :: hex string to int c# 
Csharp :: get unix time in seconds C# 
Csharp :: how to change the color of your text in c# 
Csharp :: base64 to image c# 
Csharp :: how to move a object in unity c# 
Csharp :: current directory in sln file c# 
Csharp :: stream to byte array c# 
Csharp :: c# if debug 
Csharp :: windows form rounded corners 
Csharp :: 2d unity point at 
Csharp :: c# long to int 
Csharp :: how to get random numbers in c# 
Csharp :: c# get object property value by name 
Csharp :: c# datediff minutes 
Csharp :: custom editor unity 
Csharp :: unity gameobject.findobjectswith tag set active 
Csharp :: public vs internal c# 
Csharp :: hide game obj oncollisionenter 
Csharp :: c# random choice 
Csharp :: c# get property using string 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =