Mega Code Archive

 
Categories / C# / Thread
 

New ThreadStart

using System; using System.Threading; public class SimpleThread {     public void SimpleMethod() {         int result = 1;         Console.WriteLine(result.ToString() + " from thread ID: " +                           AppDomain.GetCurrentThreadId().ToString());     }     public static void Main() {         SimpleThread simpleThread = new SimpleThread();         simpleThread.SimpleMethod();         ThreadStart ts = new ThreadStart(simpleThread.SimpleMethod);         Thread t = new Thread(ts);         t.Start();     } }