1 s output a, for example, output b 2 seconds, 3 seconds output c
CodePudding user response:
[TestMethod]Public void TimerTest ()
{
String woutStr="abcdefg";
int index=0;
The Timer Timer=new Timer (new TimerCallback (obj=& gt;
{
The Debug. WriteLine (woutStr [index % woutStr Length]);
Index++;
}), null, 0, 1000);
The timer. Change (0, 1000);
//wait for output
Thread.sleep (1000 * 10);
}
CodePudding user response:
Use nuget introduce rx.net
The