Let\'s assume this class in C#:
public class LimitedList : List
{
private int _maxitems = 500;
public void Add(T value) /* Adding
You need to declare your 'Add' method as a 'new' (replacement) method. Try this:
public class LimitedList : List
{
private int _maxitems = 500;
public new void Add(T value) /* Adding a new Value to the buffer */
{
base.Add(value);
TrimData(); /* Delete old data if length too long */
}
private void TrimData()
{
int num = Math.Max(0, base.Count - _maxitems);
base.RemoveRange(0, num);
}
}
notice the 'new' keyword in the 'Add(...' declaration.
Although, in this instance, you should create your own generic class implementing the IList interface. Hope that helps.