thread_delegation_2.cs

using System;
using System.Threading;
using System.Diagnostics;
// csc thread_delegation_2.cs
//also imples to ThreadStart examples
namespace thread_wait_delegation
{
public class Test
{
public static void process_ie()
{
thread_ie cycle = new thread_ie();
ThreadStart job = new ThreadStart(cycle.open_ie);
//job.Name= "Master counter" ;
//copy to anothr thread
Thread thread = new Thread(job);
thread.Name ="ie thread ";
thread.Start();
for (int i=0; i < 3; i++)
{
Console.WriteLine ("Main thread:------- {0}", i);
Thread.Sleep(10);
}
}
public static void process_note()
{
thread_note note = new thread_note();
ThreadStart job = new ThreadStart(note.open_note);
//job.Name= "Master counter" ;
//copy to anothr thread
Thread thread = new Thread(job);
thread.Name ="secondary thread ";
thread.Start();
for (int i=0; i < 3; i++)
{
Console.WriteLine ("note thread:------- {0}", i);
Thread.Sleep(100);
}
}
static void Main()
{
process_ie();
process_note();
Console.ReadLine();
}
}

public class thread_ie
{
public void open_ie()
{
Console.WriteLine ("name thread:---count down---- {0}",Thread.CurrentThread.Name.ToString());

Process newProc = Process.Start("iexplore.exe");
Console.WriteLine("New process started.");
newProc.WaitForExit();
newProc.Close();

}

}
public class thread_note
{
public void open_note()
{
Console.WriteLine ("name thread:---count down---- {0}",Thread.CurrentThread.Name.ToString());

Process newProc = Process.Start("notepad.exe");
Console.WriteLine("New process started.");
newProc.WaitForExit();
newProc.Close();

}
}

}

notepad kicks in immediately

Internet explorer home page will start later