Having trouble. Don't really know where to start. I need to use a helper class to populate a stack in C#. The helper class needs to have a few dozen items used to populate the stack. Then, I need to use a timer to kick off a second process that takes an Object<class> off one stack and pushes it to another stack. Afterwards, I need to have a second event that takes off of the second stack and puts the items on the third stack

My biggest problems are using a helper class to populate the first stack. Then figuring out the syntax or process to use to move that over to the second stack, with a timer. I haven't used timers before, and I'm not very good at using stacks. I can get as far as declaring a stack, and pushing items in to the first stack, but it's not what is being called for here. I don't know how to go about using the helper class to push items in to the stack. The timer, as well as moving the items in the first stack to the second is a problem for me, too. I know it would be (for a brief example) Stack 1 = 1, 2, 3, 4, 5, 6, 7,... 50 Then when it moves to the next (after the timer), it will be Stack 2 = 50, 49, 48, 47, 46, 45, 44, 43.....1 But the syntax, or how I can go about getting it going is where I'm getting stuck

If anyone could help me out, I would appreciate it.

Timers are rather easy to use, however, take note there are 3 different types (that share the same name). System.Timers.Timer, System.Threading.Timer, and System.Windows.Form.Timer. I personally like to use the Windows Form ones because that's what I usually use them with are forms. However, let's go ahead and use the first since you aren't working with a form.

Here's a quick write up of a timer object at work

using System.Timers;

Timer MyTimer = new Timer();

//Now we set how long before the timer goes off, in this case it's 1 sec, or 1000 ms
MyTimer.Interval = 1000;

//Now we assign an event so when the elapses the interval time it will be able to tell the code
MyTimer.Elapsed += new ElapsedEventHandler (MyTimer_Elapsed);

//This little guy will pretty much tell the code that once the time has passed in the interval, restart the timer. So you'll have a timer that fires every x amount of secs
//Note they say this is true by default
MyTimer.AutoReset = true;

//And lastly start the timer
MyTimer.Enabled = true;

private void MyTimer_Elapsed(object sender, ElapsedEventArgs e)
    //Process code

Now if you want to stop the timer, simply set that Enabled flag to false (if you set AutoReset to false, then you'll have to re-enable after the timer has expired, my suggestion would be in the event). That should get you started with timers.

As for stacks, they are rather easy to use, just push and pop. You should be able to easily find info on these. This site is always good http://www.dotnetperls.com/stack

However, I'm going to stop here and let you work with this, partially because I'd like to see you put in some effort on this, mainly because I have a feeling this could be a school assignment, and DaniWeb is here to help people, not write their assignments for them (it almost sounds like a caching type application, reminds me of the CPU cache simulator I had to do for my computer architecture class).