我是.NET新手。我在我的項目中使用線程。請檢查我的代碼如下 -線程VS ParameterizedThreadStart
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication6
{
class Program
{
private void Amadeus(object str)
{
Console.WriteLine(str.ToString());
}
static void Main(string[] args)
{
Program objClass = new Program();
//One way to call Amadeus Method...
Thread objThread = new Thread(objClass.Amadeus);
objThread.Start("Amadeus without ParameterizedThreadStart");
//Other way to call Amadeus Method...
ParameterizedThreadStart objParamThread = new ParameterizedThreadStart(objClass.Amadeus);
Thread ObjThreadParam = new Thread(objParamThread);
ObjThreadParam.Start("Amadeus with ParameterizedThreadStart");
Console.ReadLine();
}
}
}
請問上述兩種方式之間有什麼區別,因爲兩者都在做同樣的工作。
在此先感謝。