I’m trying to execute a function periodically, using a System.Threading.Timer. It calls the function, but it doesn’t work, and doesn’t report an error. Why?
public class Timerr
{
ArrayList listurl;
ArrayList listcategory;
protected Collection<Rss.Items> list = new Collection<Rss.Items>();
RssManager reader = new RssManager();
System.Threading.Timer Timer;
System.DateTime StopTime;
public void Run()
{
StopTime = System.DateTime.Now.AddMinutes(1);
Timer = new System.Threading.Timer(TimerCallback, null, 0,1000);
}
private void TimerCallback(object state)
{
if (System.DateTime.Now >= StopTime)
{
Timer.Dispose();
return;
}
callrss();
}
}
This works in LINQPad:
I recommend you install the free LINQPad with which you can check such things very quickly, without the need to run your entire application