Search code examples
c#thread-sleep

C# - Delay at code start


I want to make some delay on my code I used Thread.Sleep But my programs go to not responding after some Threads And then goes out of not responding after the program ended its processes I want to use something better ... Like Thread

AddToConsole("text",milliseconds)

And the AddToConsole Void :

Appendline(text);

Thread.Sleep(milliseconds);

Thanks,


Solution

  • I used to make delay in code with method (void)

    Task.Delay(millisecond).Wait()

    And delayed successfully without ant freezes ...