System.Timers.Timer.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
        protected override void Dispose(bool disposing)
        {
            Close();
            _disposed = true;
            base.Dispose(disposing);
        }

Usage Example

Example #1
0
        public void DoSend(string locationSemantic, IEnvelope message, int timeout)
        {
            var timer = new Timer(timeout * 1000);
            m_location = locationSemantic;

            try
            {
                _is_completed = false;

                timer.Elapsed += Timer_Elasped;
                timer.Start();

                this.DoSend(locationSemantic, message);
                _is_completed = true;

                timer.Stop();
            }
            catch (Exception exception)
            {
                timer.Stop();
                throw;
            }
            finally
            {
                if (timer.Enabled)
                    timer.Stop();

                timer.Elapsed -= Timer_Elasped;
                timer.Dispose();
            }

        }
All Usage Examples Of System.Timers.Timer::Dispose