Gets or sets the object used to marshal event-handler calls that are issued when an interval has elapsed.
Documentation for this section has not yet been entered.
When Timer.SynchronizingObject is null, the method that handles the Timer.Elapsed event is called on a thread from the system-thread pool. For more information on system-thread pools, see System.Threading.ThreadPool.
When the Timer.Elapsed event is handled by a visual Windows Forms component, such as a button, accessing the component through the system-thread pool might result in an exception or just might not work. Avoid this effect by setting Timer.SynchronizingObject to a Windows Forms component, which causes the method that handles the Timer.Elapsed event to be called on the same thread that the component was created on.
Even if the Timer.SynchronizingObject property is not null, Timer.Elapsed events can occur after the erload:System.Timers.Timer.Dispose or Timer.Stop method has been called or after the Timer.Enabled property has been set to false, because the signal to raise the Timer.Elapsed event is always queued for execution on a thread pool thread. One way to resolve this race condition is to set a flag that tells the event handler for the Timer.Elapsed event to ignore subsequent events.
If the System.Timers.Timer is used inside Visual Studio in a Windows Forms designer, Timer.SynchronizingObject is automatically set to the control that contains the System.Timers.Timer. For example, if you place a System.Timers.Timer on a designer for Form1 (which inherits from System.Windows.Forms.Form), the Timer.SynchronizingObject property of System.Timers.Timer is set to the instance of Form1.