dispatch - C# Dispatching code to run at a later time? -
how can dispatch code run @ later time? :
threadpool.queueuserworkitem(callback, timespan.fromseconds(1)); // call callback() 1 second
you can try following:
system.threading.timer _timeouttimer; //... int timeout = (int)timespan.fromseconds(1).totalmilliseconds; _timeouttimer = new system.threading.timer(ontimerelapsed, null, timeout, system.threading.timeout.infinite); //... void ontimerelapsed(object state) { // _timeouttimer.dispose(); }
Comments
Post a Comment