Ongoing/Thread

Thread [C#] C# 1.0 Style Thread with ThreadStart

More Code 2018. 7. 16. 11:45


// C# 1.0 Style Thread
using System;
using System.Threading;

namespace ThreadSample
{
class Program
{
static void Main(string[] args)
{
// C# 1.0 Style Thread uses ThreadStart
ThreadStart ts = new ThreadStart(Work);
Thread t1 = new Thread(ts);

t1.Start();

for (int count = 0; count < Repetitions; count++)
{
Console.Write('@');
}
}

static void Work()
{
for (int count = 0; count < Repetitions; count++)
{
Console.Write('.');
}
}

const int Repetitions = 1000;
}
}