MSDN解释:
究竟哪个是烧毁Timer对象的方法?
我在我的项目用close,但是timer还在,用dispose就可以,但是
timer.dispose( );
if (timer != null)
{
_timeWeather.Enabled = true;
}
今天调试的时候竟然进入了if语句里面执行,我明明用了dispose方法
dear
.NET并不会马上将Close后的物件变为null,要等一下下,你可自行指定null
最保险做法,就是Dispose之后再指定null
timer.dispose( ); timer = null; if (timer != null) { _timeWeather.Enabled = true; }