Click here to Skip to main content
15,891,749 members
Articles / Programming Languages / C#

Multithreaded Programming Using C#

Rate me:
Please Sign up or sign in to vote.
4.71/5 (164 votes)
10 Oct 2001CPOL6 min read 857.3K   12   323  
A simple tutorial on Multithreaded Programming using C#
using System;
using System.Threading;

public class MyThread {

        public void Thread1() {

		Console.WriteLine(Thread.GetDomain() );

                for (int i = 0; i < 10; i++) {

			Thread thr = Thread.CurrentThread;
			Console.WriteLine(i);
                }
        }
}

public class MyClass {

        public static void Main() {
            Console.WriteLine("Before start thread");

		MyThread thr1 = new MyThread();

		Thread tid1 = new Thread(new ThreadStart(thr1.Thread1) );

		tid1.Start();

        }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader American Institute for Research
United States United States
Working as a Team leader in American Institute for Research

Comments and Discussions