This bit of code should point you in the right direction.
public class Program
{
static void Main(string[] args)
{
AppDomain domain = AppDomain.CreateDomain("SecondDomain");
System.Threading.Thread.CurrentThread.Name = "Thread 2";
// Thread.Start in first domain
System.Threading.Thread thread = new
System.Threading.Thread(SomeMethod);
thread.Name = "Thread 1";
thread.Start();
// Current thread, for simpliicty, second domain
domain.DoCallBack(new CrossAppDomainDelegate(SomeMethod));
Console.ReadLine();
}
static void SomeMethod()
{
Console.WriteLine("Domain: " +
AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("Thread: " +
System.Threading.Thread.CurrentThread.Name );
}
}
The CrossAppDomainDelegate is a good tool for threading across appdomain
boundaries.
HTH,
D. Swicegood
"Polaris" <et*******@hotmail.comwrote in message
news:14**********************************@microsof t.com...
Hi C# Experts:
I have 2 threads and I like to run them in seperate AppDomains.
In other words, I want to start 2 new AppDomains and then run a thread
within each of the AppDomains. How to do it?
Thanks
Polaris