new ThreadStart

image_pdfimage_print
   
 

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();
    }
}

    


This entry was posted in Thread. Bookmark the permalink.