Thursday, September 29, 2011

how to start thread ?

using System;

using System.Threading;

public class ThreadTest {

    public void csharpeMethod() {

        int result = 1;

        Console.WriteLine(result.ToString() + "  Thread ID is  " +

                          AppDomain.GetCurrentThreadId().ToString());

    }

    public static void Main() {

        ThreadTest objThread = new ThreadTest ();

        objThread.csharpeMethod();

        ThreadStart objts = new ThreadStart(objThread.csharpeMethod);

        Thread obj = new Thread(objts);

        obj.Start();

    }

}


ASPdotNET-Example