Consider the following example taken from http://www.albahari.com/threading/:
using System;
using System.Threading;
class ThreadTest
{
static void Main()
{
Thread t = new Thread (WriteY); // Kick off a new thread
t.Start(); // running WriteY()
// Simultaneously, do something on the main thread.
for (int i = 0; i < 1000; i++) Console.Write ("x");
}
static void WriteY()
{
for (int i = 0; i < 1000; i++) Console.Write ("y");
}
}
How do I modify the code to allow WriteY() to accept a string parameter so that I can have one thread pass “x” and one pass “y”?
1 Answer