Sznikák példakódok
class ThreadTestClass
{
public static void Main(string[] args)
{
Thread t = null;
if (args.Length == 0)
{
t = new Thread(new ThreadStart(ThreadMethod1));
t.Start();
}
else
{
t = new Thread(new ParameterizedThreadStart(ThreadMethod2));
t.Start(args[0]);
}
}
public static void ThreadMethod1()
{
Console.WriteLine("Thread without parameter.");
}
public static void ThreadMethod2(object param)
{
Console.WriteLine("Thread with parameter: {0}", param.ToString());
}
}