Class UniqueListBase<T, TList, TListFactory>
This is a list containing unique items. You can specify what list type that you would use as Inner list
Inheritance
Implements
Inherited Members
Namespace: ImageVault.Common.Lib.Collections.Generic
Assembly: ImageVault.Common.dll
Syntax
public abstract class UniqueListBase<T, TList, TListFactory> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable where TList : class, IList<T>, new()
where TListFactory : class, IListFactory<T, TList>, new()
Type Parameters
Name | Description |
---|---|
T | |
TList | |
TListFactory |
Constructors
UniqueListBase(Boolean, Int32)
Initializes a new instance of the UniqueList<T> class.
Declaration
protected UniqueListBase(bool quiet = false, int capacity = 16)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | quiet | |
System.Int32 | capacity |
UniqueListBase(IEqualityComparer<T>, Boolean, Int32)
Initializes a new instance of the UniqueList<T> class.
Declaration
protected UniqueListBase(IEqualityComparer<T> comparer, bool quiet = false, int capacity = 16)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEqualityComparer<T> | comparer | |
System.Boolean | quiet | |
System.Int32 | capacity |
UniqueListBase(Func<T, T, Boolean>, Boolean, Int32)
Initializes a new instance of the UniqueList<T> class.
Declaration
protected UniqueListBase(Func<T, T, bool> comparer, bool quiet = false, int capacity = 16)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, T, System.Boolean> | comparer | |
System.Boolean | quiet | |
System.Int32 | capacity |
UniqueListBase(Int32)
Initializes a new instance of the UniqueList<T> class.
Declaration
protected UniqueListBase(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The number of items the list initially can store |
Fields
DefaultCapacity
Default capacity of new created lists if not specified
Declaration
protected const int DefaultCapacity = 16
Field Value
Type | Description |
---|---|
System.Int32 |
DefaultQuiet
Default value for the quiet parameter
Declaration
protected const bool DefaultQuiet = false
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
Comparer
Get/Sets the Comparer of the UniqueList
Declaration
public IEqualityComparer<T> Comparer { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEqualityComparer<T> |
Count
Gets the Count of the UniqueList
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
InnerList
Get/Sets the InnerList of the UniqueList
Declaration
protected TList InnerList { get; set; }
Property Value
Type | Description |
---|---|
TList |
IsReadOnly
Gets the IsReadOnly of the UniqueList
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[Int32]
Get/Sets the item identified by the given arguments of the UniqueList
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
T |
Quiet
Get/Sets the Quiet of the UniqueList
Declaration
public bool Quiet { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If set to true, this will not throw any exception on duplicate inserts, only ignore the insert. |
Methods
Add(T)
Adds an item to the list
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item |
AddRange(IEnumerable<T>)
Adds a range of items to the list
Declaration
public void AddRange(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | items |
Clear()
Clears the items from the list
Declaration
public void Clear()
Contains(T)
Returns a value indicating whether the specified item
is contained in the UniqueList<T>.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to locate in the UniqueList<T>. |
Returns
Type | Description |
---|---|
System.Boolean | true if the T parameter is a member of the UniqueList<T>; otherwise, false. |
CopyTo(T[], Int32)
Copies the list to a typed array
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to copy to |
System.Int32 | arrayIndex | The zero-based index in array where the copy starts |
GetEnumerator()
Returns an enumerator that iterates through the UniqueList<T>
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> |
IndexOf(T)
Searches for the item and returns the zero-based index of the first occurance of the item
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to search for |
Returns
Type | Description |
---|---|
System.Int32 |
Insert(Int32, T)
Inserts an item in the list
Declaration
public void Insert(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which the item should be inserted |
T | item | The item to insert |
Remove(T)
Removes an item from the list
Declaration
public bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveAt(Int32)
Removes the item at the specified index
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the item to remove |
ToString()
Returns a System.String that represents the current UniqueList<T>.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents the current UniqueList<T>. |
Overrides
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through the collection
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |