Horje
c# thread sleep Code Example
c# Sleep
using System.Threading;

static void Main()
{
  //do stuff
  Thread.Sleep(5000) //will sleep for 5 sec
}
c# thread sleep
Thread.Sleep(2000); //in ms
c# thread sleep
2
  3
  4
  5
  6
c# thread wait

public class Form1 : Form
{
    int _count;

    void ButtonClick(object sender, EventArgs e)
    {
        ThreadWorker worker = new ThreadWorker();
        worker.ThreadDone += HandleThreadDone;

        Thread thread1 = new Thread(worker.Run);
        thread1.Start();

        _count = 1;
    }

    void HandleThreadDone(object sender, EventArgs e)
    {
        // You should get the idea this is just an example
        if (_count == 1)
        {
            ThreadWorker worker = new ThreadWorker();
            worker.ThreadDone += HandleThreadDone;

            Thread thread2 = new Thread(worker.Run);
            thread2.Start();

            _count++;
        }
    }

    class ThreadWorker
    {
        public event EventHandler ThreadDone;

        public void Run()
        {
            // Do a task

            if (ThreadDone != null)
                ThreadDone(this, EventArgs.Empty);
        }
    }
}

Source: devarama.com




Csharp

Related
unity add explosion force Code Example unity add explosion force Code Example
start new form c# Code Example start new form c# Code Example
move file from one folder to another c# Code Example move file from one folder to another c# Code Example
Unity C# make object face away Code Example Unity C# make object face away Code Example
index of an enum c# Code Example index of an enum c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12