system.timers.timer autoreset默认值

时间:2014-06-19 09:16:29

标签: c# timer

我只是想知道这个属性的默认值。 我认为这是假的,但似乎是真的。

我花了5分钟来寻找这个问题,这也许会让一个人在未来的时间里没有失去...

1 个答案:

答案 0 :(得分:2)

来自msdn的回答默认为 true

http://msdn.microsoft.com/en-us/library/system.timers.timer.autoreset%28v=vs.110%29.aspx

来自Reflector的答案默认值= true

public Timer(double interval) : this()
{
    ...
}

public Timer()
{
    this.interval = 100.0;
    this.enabled = false;
    //HERE!!!!
    this.autoReset = true;
    this.initializing = false;
    this.delayedEnable = false;
    this.callback = new TimerCallback(this.MyTimerCallback);
}