c# - Timer for a dictionary -


i have created dynamic timer. time has take time intervals dictionary. when run program says index not exist. , says when y=0;

var timer = new system.windows.forms.timer();  int track = 0; int y = 0;  timer.tick += (object sender, eventargs e) => {     timer.interval = pqueuvalues[y];     if (track < nodenum)     {           txtoutput.text += "\r\r\n" + "the node name is:  " + normalqueuname[track] + "  priority:  " + pqueuvalues[track];            ++track;      }        else      {            timer.stop();      }   };   timer.start(); 

when use int key type, dictionary indexes key not numerical position of element. if don't have element key value of 0, fail. can use elementat method use position index:

timer.interval = pqueuvalues.elementat(y).value; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -