Class CollectionWithoutDuplicatesStringComparing<T>
- Namespace
- SunamoCollectionWithoutDuplicates
- Assembly
- SunamoCollectionWithoutDuplicates.dll
A collection that automatically prevents duplicate items by comparing their string representations.
public class CollectionWithoutDuplicatesStringComparing<T> : CollectionWithoutDuplicatesBase<T>
Type Parameters
TThe type of items in the collection.
- Inheritance
-
CollectionWithoutDuplicatesStringComparing<T>
- Inherited Members
- Extension Methods
Constructors
CollectionWithoutDuplicatesStringComparing()
Initializes a new instance of the collection that compares items by their string representation.
public CollectionWithoutDuplicatesStringComparing()
CollectionWithoutDuplicatesStringComparing(IList<T>)
Initializes a new instance of the collection from an existing list.
public CollectionWithoutDuplicatesStringComparing(IList<T> list)
Parameters
listIList<T>The list to initialize from.
CollectionWithoutDuplicatesStringComparing(int)
Initializes a new instance of the collection with a specified initial capacity.
public CollectionWithoutDuplicatesStringComparing(int initialCapacity)
Parameters
initialCapacityintThe initial capacity of the collection.
Methods
AddWithIndex(T)
Adds an item to the collection and returns its index. If the item already exists (based on string comparison), returns the existing index.
public override int AddWithIndex(T value)
Parameters
valueTThe item to add.
Returns
- int
The index of the item in the collection.
Contains(T)
Determines whether the collection contains the specified item based on string comparison.
public override bool? Contains(T value)
Parameters
valueTThe item to check.
Returns
- bool?
True if the item exists, false otherwise.
IndexOf(T)
Returns the index of the specified item based on string comparison.
public override int IndexOf(T value)
Parameters
valueTThe item to find.
Returns
- int
The zero-based index of the item.
IsComparingByString()
Determines whether the collection compares items by their string representation.
protected override bool IsComparingByString()
Returns
- bool
Always returns true for this class.