I need to pass the following int dldnow to sendData static method / delegate.
public int dldnow; Timer timer = new Timer(new TimerCallback(sendData), null, 1000*30, 1000*30); public static void sendData(object obj) { string imageCount = (string)dldnow; string imageCountJson = wc.DownloadString("http://*********/u.php?count=" + imageCount); }
dldnowas the parameterstate(where you writenullnow). Another thing: You don't have to writenew TimerCallback(sendData)in full. Since C# 2 you can just writesendData(this is called method group conversion).