C# how to implement a loop with time step
I need to implement a function tha开发者_开发问答t contains a loop of instructions that should run every .01 second is there a way to implement a loop(e.g for each time step) that can do that thanks in advance
You can use Timer class like this:
Timer t = new Timer(100);
t.Elapsed += (sender, e) =>
{
for (int i = 0; i < 10; i++)
{
// your loop
}
};
t.Start();
You can generate a recurring event using the Timer class.
精彩评论