title: does nulling a System.Threading.Timer stop it?
body: <p>If I have an active <a href="http://msdn.microsoft.com/en-us/library/system.threading.timer(VS.90).aspx" rel="noreferrer">System.Threading.Timer</a> and I set it to null, is it stopped?</p>
  <p>I realize that it is more proper to call  <code>.Dispose()</code> but I would like an answer to the question as written.</p>
  <pre><code>public class Foo
  {
     private System.Threading.Timer _timer;
     public Foo()
     {
        // initialize timer
     }
  
     public void KillTimer()
     {
        _timer=null;
     }
  }
  </code></pre>
  <hr />
  <h3>Update:</h3>
  <p>After much back and forth about whether setting a single reference to a System.Threading.Timer to null will indeed result stopping it have shown that</p>
  <ol>
  <li>there are no lingering references, e.g. events list, as a threading timer takes a sinlge callback and does not expose events.</li>
  <li>that <em><strong>if</strong></em> GC collects, the finalizer will indeed dispose the TimerBase and stop the timer.</li>
  </ol>
  <p>spike</p>
  <pre><code>using System;
  using System.Threading;
  
  namespace SO_3597276
  {
      class Program
      {
          private static System.Threading.Timer _timer;
  
          static void Main(string[] args)
          {
              _timer = new Timer((s) =&gt; Console.WriteLine(&quot;fired&quot;), null, 1000, Timeout.Infinite);
              _timer = null;
              GC.Collect();
              Console.ReadKey();
          }
      }
  }
  </code></pre>
  <p>The timer callback is not called. Remove <code>GC.Collect()</code> and the callback is called.</p>
  <p>Thanks all.</p>