Possible Duplicates:
Timer, event and garbage collection : am I missing something ?
If I'd have the following code:
public void SomeMethod()
{
Timer timer = new Timer();
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
will timer_Tick continue to be repeatedly called after the SomeMethod has finished even though there is no reference to the timer anywhere?
I'm thinking maybe it will until the Timer's Dispose method is called. But then, in general, does the GC knows when an object have not been disposed?