Box

Box

  • NA
  • 51
  • 41.7k

Queue's

Dec 20 2011 5:57 AM
Hi

Im unsure of how to do this. Spent most of yesterday trying various things but just ran into error after error and am now lost.

Basically I have a timer than runs every 10ms. It works out a value each time and I want to know the value it worked out 2.5 seconds ago.

My thoughts on doing this would be to have the value added to a queue once it is up to 250 I can start reading back. The logic seems easy enough to me. I just dont know how to put it into practice.

How can I 'globalise' the queue so that it isnt destroyed each time in the timer.

People suggested using a static class along the lines of


static class globalSpeed
{
private static Queue gSpeed = new Queue();
public static string Speed
{
get { return gSpeed; }
set { gSpeed = value; }
}
}

but this gave all kinds of errors. static errors, conversion errors.

Can someone please point me in the right direction to go about this.

thanks

Answers (8)