by tsachi
14. March 2009 16:12
public class MRUList<T> : List<T>
{
// Summary:
// Initializes a new instance of the System.Collections.Generic.List<T> class
// that is empty and has the default initial capacity.
public MRUList() : base() {}
//
// Summary:
// Initializes a new instance of the System.Collections.Generic.List<T> class
// that contains elements copied from the specified collection and has sufficient
// capacity to accommodate the number of elements copied.
//
// Parameters:
// collection:
// The collection whose elements are copied to the new list.
//
// Exceptions:
// System.ArgumentNullException:
// collection is null.
public MRUList(IEnumerable<T> collection) : base(collection) {}
//
// Summary:
// Initializes a new instance of the System.Collections.Generic.List<T> class
// that is empty and has the specified initial capacity.
//
// Parameters:
// capacity:
// The number of elements that the new list can initially store.
//
// Exceptions:
// System.ArgumentOutOfRangeException:
// capacity is less than 0.
public MRUList(int capacity) : base(capacity) {}
// Summary:
// Adds an object to the end of the System.Collections.Generic.List<T>.
//
// Parameters:
// item:
// The object to be added to the end of the System.Collections.Generic.List<T>.
// The value can be null for reference types.
public new void Add(T item)
{
if( Capacity == Count )
{
RemoveAt(0);
};
base.Add( item );
}
}
cce7bdc2-711f-40a6-97d3-ca1a4b25decd|0|.0
Tags:
C# & .Net