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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -