Table of Contents

Class CollectionWithoutDuplicates<T>

Namespace
SunamoCollectionWithoutDuplicates
Assembly
SunamoCollectionWithoutDuplicates.dll

A collection that automatically prevents duplicate items. Supports both normal comparison and string-based comparison.

public class CollectionWithoutDuplicates<T> : CollectionWithoutDuplicatesBase<T>

Type Parameters

T

The type of items in the collection.

Inheritance
CollectionWithoutDuplicates<T>
Inherited Members
Extension Methods

Constructors

CollectionWithoutDuplicates()

Initializes a new instance of the collection without duplicates.

public CollectionWithoutDuplicates()

CollectionWithoutDuplicates(IList<T>)

Initializes a new instance of the collection without duplicates from an existing list.

public CollectionWithoutDuplicates(IList<T> list)

Parameters

list IList<T>

The list to initialize from.

CollectionWithoutDuplicates(int)

Initializes a new instance of the collection without duplicates with a specified initial capacity.

public CollectionWithoutDuplicates(int initialCapacity)

Parameters

initialCapacity int

The initial capacity of the collection.

Methods

AddWithIndex(T)

Adds an item to the collection and returns its index. If the item already exists, returns the existing index.

public override int AddWithIndex(T value)

Parameters

value T

The item to add.

Returns

int

The index of the item in the collection.

Contains(T)

Determines whether the collection contains the specified item.

public override bool? Contains(T value)

Parameters

value T

The item to check.

Returns

bool?

True if the item exists, false if not, null if the item is null and nulls are allowed.

IndexOf(T)

Returns the index of the specified item in the collection. If the item does not exist, it is added and the new index is returned.

public override int IndexOf(T value)

Parameters

value T

The 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

True if comparing by string, false otherwise.