JynxRD
May 10th, 2009, 04:07 PM
I'm learning threads currently and I'm a bit stumped. Hopefully someone can help me along here.
Here are my instructions from my book exactly as they are written
======
Write a C# application that has five threads running at the same time. Each thread outputs to the console the following five strings ten times each ("AAA", "BBB", "CCC", "DDD", "EEE"). You should only need a single method that actually does the work, you will create multiple threads using this single method.
======
This is what I put together while trying to learn threads but I'm not sure how to do what they are asking.
using System;
using System.Text;
using System.Threading;
class Test
{
static void MyThreadMethod()
{
Console.WriteLine("AAA, BBB, CCC, DDD, EEE.");
Console.ReadLine();
}
static void Main()
{
Thread threadObj = new Thread(new ThreadStart(MyThreadMethod));
threadObj.Start();
}
}
Here are my instructions from my book exactly as they are written
======
Write a C# application that has five threads running at the same time. Each thread outputs to the console the following five strings ten times each ("AAA", "BBB", "CCC", "DDD", "EEE"). You should only need a single method that actually does the work, you will create multiple threads using this single method.
======
This is what I put together while trying to learn threads but I'm not sure how to do what they are asking.
using System;
using System.Text;
using System.Threading;
class Test
{
static void MyThreadMethod()
{
Console.WriteLine("AAA, BBB, CCC, DDD, EEE.");
Console.ReadLine();
}
static void Main()
{
Thread threadObj = new Thread(new ThreadStart(MyThreadMethod));
threadObj.Start();
}
}