MSDN上的例子:
using System;
using System.Threading;
public class Example
{
private static Timer ticker;
public static void TimerMethod(object state)
{
Console.Write(".");
}
public static void Main()
{
ticker = new Timer(TimerMethod, null, 1000, 1000);
Console.WriteLine("Press the Enter key to end the program.");
Console.ReadLine();
}
}
问题:Timer的第2个参数为什么是null?MSDN上有解释说“对于任何托管对象,如果没有对 Timer 的引用, Timer 会被垃圾回收,即使 Timer 仍处在活动状态。”这个null是否和后面的解释矛盾?