BlueSky
BlueSky

Reputation: 5

How can I add millisecond delay to my TimeSpan?

I am using the code below as it only works with int value greater than one.

Does any one have idea of can I change it with millisecond value or even no delay at all? or any other alternative method?

DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0);
timer.Tick += delegate
{
    timer.Stop();
    // my image code generator
    timer.Start();
};
timer.Start();

Upvotes: 0

Views: 3005

Answers (1)

speti43
speti43

Reputation: 3046

It has a constructor for that pupose:

TimeSpan(Int32, Int32, Int32, Int32, Int32);

So:

new TimeSpan(0, 0, 0, 0, 1);

Upvotes: 3

Related Questions