using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using ThreadLibrary;

namespace ThreadStarten
{
   public class Program
   {
      public static void Main(string[] args)
      {

         AppDomainSetup setup = new AppDomainSetup();

         setup.ApplicationBase = Environment.CurrentDirectory;
         setup.PrivateBinPath = "bin";
         setup.ConfigurationFile = "ApplicationName.exe.config";

         AppDomain domain = AppDomain.CreateDomain("friendlyName", null, setup);

         Tasks tsk = (Tasks)domain.CreateInstanceAndUnwrap("ThreadLibrary", typeof(Tasks).FullName);

         ThreadStart ts = new ThreadStart(tsk.Action1);
         ParameterizedThreadStart pts = new ParameterizedThreadStart(tsk.Action2);

         Thread t1 = new Thread(ts);
         Thread t2 = new Thread(pts);

         t1.Name = "Thread 1";
         t2.Name = "Thread 2";

         t1.Start(); ;
         t2.Start("Hauptprogramm");

         Console.ReadLine();
      }
   }
}
