Ongoing/Thread

Thread [C#] C# 2.0 Style Thread without ThreadStart

More Code 2018. 7. 16. 11:47


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

namespace ThreadSample
{
class Program
{
static void Main(string[] args)
{
// C# 2.0 Style Thread does not use ThreadStart
Thread t2 = new Thread(Work);

t2.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;
}
}