using System.Collections.Generic;
namespace Masuit.Tools.Systems
{
///
/// 定长队列
///
///
public class LimitedQueue : Queue
{
///
/// 队列长度
///
public int Limit { get; set; }
///
/// 定长队列
///
///
public LimitedQueue(int limit) : base(limit)
{
Limit = limit;
}
///
/// 入队
///
///
public new void Enqueue(T item)
{
if (Count >= Limit)
{
Dequeue();
}
base.Enqueue(item);
}
}
}