System.Timers.Timer.Stop Method

Stops raising the Timer.Elapsed event by setting Timer.Enabled to false.

Syntax

public void Stop ()

Remarks

You can also stop timing by setting Timer.Enabled to false.

Note:

The signal to raise the Timer.Elapsed event is always queued for execution on a System.Threading.ThreadPool thread, so the event-handling method might run on one thread at the same time that a call to the Timer.Stop method runs on another thread. This might result in the Timer.Elapsed event being raised after the Timer.Stop method is called. The code example in the next section shows one way to work around this race condition.

Requirements

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