System.Timers.Timer.AutoReset Property

Gets or sets a value indicating whether the System.Timers.Timer should raise the Timer.Elapsed event each time the specified interval elapses or only after the first time it elapses.

Syntax

[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.DefaultValue(true)]
[System.Timers.TimersDescription("Indicates whether the timer will be restarted when it is enabled.")]
public bool AutoReset { get; set; }

Value

true if the timer will raise the Elapsed event multiple times when Interval passes, false if it will raise it just once.

Remarks

If the System.Timers.Timer is already enabled when the Timer.Start method is called, the interval is reset. If Timer.AutoReset is false, the Timer.Start method must be called in order to start the count again.

Resetting the interval affects when the Timer.Elapsed event is raised. For example, if you set the interval to 5 seconds and then set the Timer.Enabled property to true, the count starts at the time Timer.Enabled is set. If you reset the interval to 10 seconds when the count is 3 seconds, the Timer.Elapsed event is raised for the first time 13 seconds after the Timer.Enabled property was set to true.

Requirements

Namespace: System.Timers
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0