I have created threads dynamically.

static void Main(string[] args)
{
    int ThreadCount = Convert.ToInt32(ConfigurationManager.AppSettings["Threads"]);
    List<Thread> th = new List<Thread>();
    for (int i = 0; i < ThreadCount; i++)
    {
        Thread t = new Thread(print);
        th.Add(t);
    }
    foreach (Thread t in th)
    {
        t.Start();
    }
}

public void print()
{
    console.writeline("123");
}

I want to know when this threads will complete.
On completion of these threads i want to print a message of "DONE"

How can i do this.

Join() the threads.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.