As System.Timers.Timer and System.Windows.Forms.Timer both use the ThreadPool it doesn't have a handle to an operating system timer, so there is no native timer resource that's disposed of - just a completed thread. I'm not sure you can capture a thread being recycled by the ThreadPool but I might be wrong.
You could maybe roll your own (I haven't tested this, and taking a ManualResetEvent in Dispose might be more useful):
void Run()
{
ManualResetEvent resetEvent = new ManualResetEvent(false);
System.Threading.Timer timer = new System.Threading.Timer(delegate { Console.WriteLine("Tick"); });
timer.Dispose(resetEvent);
MyTimer t = new MyTimer();
t.Interval = 1000;
t.Elapsed += delegate { t.Dispose(resetEvent); };
resetEvent.WaitOne();
}
public class MyTimer : System.Timers.Timer
{
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
public virtual void Dispose(WaitHandle handle)
{
handle.SafeWaitHandle.Close();
Dispose();
}
}