Class ConditionalCollection<T>
Provides the abstract base class for a generic, conditional collection.
Inheritance
Implements
Namespace: Cuemon.Collections.Generic
Assembly: Cuemon.Core.dll
Syntax
public abstract class ConditionalCollection<T> : ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of elements in the collection. |
Constructors
| Improve this DocConditionalCollection()
Initializes a new instance of the ConditionalCollection<T> class.
Declaration
protected ConditionalCollection()
Properties
| Improve this DocCount
Gets the number of elements contained in the ConditionalCollection<T>.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of elements actually contained in the ConditionalCollection<T>. |
IsReadOnly
Gets a value indicating whether the ConditionalCollection<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this DocAdd(T)
Adds an item to the ConditionalCollection<T>.
Declaration
public abstract void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to add to the ConditionalCollection<T>. |
Add(T, Action)
Adds an item to the ConditionalCollection<T>.
Declaration
protected void Add(T item, Action validator)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to add to the ConditionalCollection<T>. |
System.Action | validator | The delegate that validates the |
Clear()
Removes all items from the ConditionalCollection<T>.
Declaration
public void Clear()
Contains(T)
Determines whether the ConditionalCollection<T> contains a specific value.
Declaration
public abstract bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the ConditionalCollection<T>. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Contains(T, IEqualityComparer<T>)
Determines whether the ConditionalCollection<T> contains a specific value by using a specified comparer
.
Declaration
protected bool Contains(T item, IEqualityComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the ConditionalCollection<T>. |
System.Collections.Generic.IEqualityComparer<T> | comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing the specified |
Returns
Type | Description |
---|---|
System.Boolean |
|
CopyTo(T[], Int32)
Copies the elements of the ConditionalCollection<T> to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The one-dimensional System.Array that is the destination of the elements copied from ConditionalCollection<T>. The System.Array must have zero-based indexing. |
System.Int32 | arrayIndex | The zero-based index in |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> | An enumerator that can be used to iterate through the collection. |
Remove(T)
Removes the first occurrence of a specific object from the ConditionalCollection<T>.
Declaration
public abstract bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to remove from the ConditionalCollection<T>. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remove(T, Func<T, Boolean>, IEqualityComparer<T>)
Removes all occurrences of a specific object from the ConditionalCollection<T> that match the conditions defined by the specified predicate
and comparer
.
Declaration
protected bool Remove(T item, Func<T, bool> predicate, IEqualityComparer<T> comparer = null)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to remove from the ConditionalCollection<T>. |
System.Func<T, System.Boolean> | predicate | The function delegate that will iterate and match the specified |
System.Collections.Generic.IEqualityComparer<T> | comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing the specified |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit Interface Implementations
| Improve this DocIEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |