我正在尝试运行线程池,并希望获得所有线程的运行时。这是我的代码。我错过了什么吗?
static void Main(string[] args)
{
Console.Write("Enter fund symbol: ");
String stockSymbol = Console.ReadLine();
int numberOfFunds = 1;
String[] fundArray = new String[numberOfFunds];
ManualResetEvent[] resetEvents = new ManualResetEvent[numberOfFunds];
var startTime = DateTime.Now;
for (int s = 0; s < numberOfFunds; s++)
{
fundArray[s] = stockSymbol;
resetEvents[s] = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(new WaitCallback(getStats), (object)fundArray[s]);
}//END THREADLOOP
WaitHandle.WaitAll(resetEvents);
runTime((object)startTime);
Console.ReadKey();
}//END MAIN