Sorry.....
I lied.
I forgot that I need to resize the stack if I make it smaller.
What I meant was............
using System;
using System.Collections;
namespace System.Collections
{
///
/// Stack class which when it reaches a given size drops the oldest item in the stack to allow the newest item to be pushed on.
///
public class MaxSizedStack: Stack
{
private int maxSize;
public MaxSizedStack(int maxSize)
{
this.maxSize = maxSize;
}
public int MaxSize {
get
{
return maxSize;
}
set
{
if(value0);
//Discard oldest item
invert.Pop();
do
{
base.Push(invert.Pop());
} while(invert.Count>0);
}
base.Push(obj);
}
}
}
Obviously.
Posted By: Johnny Comecardiff on January 7th 2008 at 14:43:48
Message Thread
- FAO: Anyone who was thoroughly puzzled by my geekage earlier........ (General Chat) - Johnny Comecardiff, Jan 7, 14:08:28
- Sorry..... (General Chat) - Johnny Comecardiff, Jan 7, 14:43:48
- That's what I would have done. (n/m) (General Chat) - malkybarkid, Jan 7, 14:09:49
- And as for the test harness...... (General Chat) - Johnny Comecardiff, Jan 7, 14:09:48
- I don't see any NUINT in there. Unproffessional. (n/m) (General Chat) - Snakey, Jan 7, 14:11:21
- ^^^ pens (n/m) (General Chat) - Arizona Bay, Jan 7, 14:09:30
- My pen....... (General Chat) - Johnny Comecardiff, Jan 7, 14:26:33
- base, push, and PUMP! (n/m) (General Chat) - pants, Jan 7, 14:08:56
- Pump up the Jam. (n/m) (General Chat) - Snakey, Jan 7, 14:11:38
Reply to Message
In order to add a post to the WotB Message Board you must be a registered WotB user.
If you are not yet registered then please visit the registration page. You should ensure that their browser is setup to accept cookies.