Class DebugCollection<T>
- Namespace
- SunamoDebugCollection
- Assembly
- SunamoDebugCollection.dll
A debug-friendly collection that can be used in both development and production environments. Provides functionality to prevent adding specific items to the collection.
public class DebugCollection<T> : List<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
Type Parameters
TThe type of elements in the collection.
- Inheritance
-
List<T>DebugCollection<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
DebugCollection()
Initializes a new instance of the DebugCollection<T> class.
public DebugCollection()
DebugCollection(IList<T>)
Initializes a new instance of the DebugCollection<T> class with items from an existing collection.
public DebugCollection(IList<T> list)
Parameters
listIList<T>The collection whose elements are copied to the new collection.
DebugCollection(int)
Initializes a new instance of the DebugCollection<T> class with a specified capacity.
public DebugCollection(int count)
Parameters
countintThe initial capacity of the collection.
Properties
DontAllow
Gets or sets the list of items that should not be allowed to be added to this collection.
public List<T> DontAllow { get; set; }
Property Value
- List<T>
this[int]
Gets or sets the element at the specified index.
public T this[int index] { get; set; }
Parameters
indexintThe zero-based index of the element to get or set.
Property Value
- T
The element at the specified index.
Methods
Add(T)
Adds an item to the collection if it is not in the DontAllow list.
public void Add(T value)
Parameters
valueTThe value to add to the collection.