[]
        
(Showing Draft Content)

C1.LiveLinq.Indexing.SubindexCollection-1.Add

Add Method

Add<TKey>(Expression<Func<T, TKey>>, bool, bool, IndexingAlgorithm, CultureInfo)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T, TKey> Add<TKey>(Expression<Func<T, TKey>> keySelector, bool keyIsUnique, bool onlyOnce, IndexingAlgorithm algorithm, CultureInfo locale)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

Key selector expression of the subindex, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this subindex is unique for any given value of the parent key (default: false).

bool onlyOnce

Specifies whether it is required that the subindex does not exist prior to this method call (default: false). If a subindex with this keySelector already exists, an exception is thrown if it is true, and this method call is ignored if it is false.

IndexingAlgorithm algorithm

An IndexingAlgorithm used by the subindex. In the current version, only one algorithm is supported, RedBlackTree. Later versions may support other algorithms, such as bitmap or hash indexing.

CultureInfo locale

Locale information used to compare strings in the subindex (default: CultureInfo.CurrentCulture).

Returns
Type Description
Subindex<T, TKey>

The new subindex added to its parent's Subindexes collection.

Type Parameters
Name Description
TKey

The type of the subindex key.

Remarks

A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.

But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an InvalidOperationException.

For a subindex, uniqueness means that any given pair of parent key and subindex key values uniquely determines an item in the indexed collection.

Add<TKey>(Expression<Func<T, TKey>>, bool, bool, CultureInfo)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T, TKey> Add<TKey>(Expression<Func<T, TKey>> keySelector, bool keyIsUnique, bool onlyOnce, CultureInfo locale)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

Key selector expression of the subindex, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this subindex is unique for any given value of the parent key (default: false).

bool onlyOnce

Specifies whether it is required that the subindex does not exist prior to this method call (default: false). If a subindex with this keySelector already exists, an exception is thrown if it is true, and this method call is ignored if it is false.

CultureInfo locale

Locale information used to compare strings in the subindex (default: CultureInfo.CurrentCulture).

Returns
Type Description
Subindex<T, TKey>

The new subindex added to its parent's Subindexes collection.

Type Parameters
Name Description
TKey

The type of the subindex key.

Remarks

A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.

But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an InvalidOperationException.

For a subindex, uniqueness means that any given pair of parent key and subindex key values uniquely determines an item in the indexed collection.

Add<TKey>(Expression<Func<T, TKey>>, bool, bool)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T, TKey> Add<TKey>(Expression<Func<T, TKey>> keySelector, bool keyIsUnique, bool onlyOnce)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

Key selector expression of the subindex, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this subindex is unique for any given value of the parent key (default: false).

bool onlyOnce

Specifies whether it is required that the subindex does not exist prior to this method call (default: false). If a subindex with this keySelector already exists, an exception is thrown if it is true, and this method call is ignored if it is false.

Returns
Type Description
Subindex<T, TKey>

The new subindex added to its parent's Subindexes collection.

Type Parameters
Name Description
TKey

The type of the subindex key.

Remarks

A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.

But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an InvalidOperationException.

For a subindex, uniqueness means that any given pair of parent key and subindex key values uniquely determines an item in the indexed collection.

Add<TKey>(Expression<Func<T, TKey>>, bool)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T, TKey> Add<TKey>(Expression<Func<T, TKey>> keySelector, bool keyIsUnique)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

Key selector expression of the subindex, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this subindex is unique for any given value of the parent key (default: false).

Returns
Type Description
Subindex<T, TKey>

The new subindex added to its parent's Subindexes collection.

Type Parameters
Name Description
TKey

The type of the subindex key.

Remarks

A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.

But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an InvalidOperationException.

For a subindex, uniqueness means that any given pair of parent key and subindex key values uniquely determines an item in the indexed collection.

Add<TKey>(Expression<Func<T, TKey>>)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T, TKey> Add<TKey>(Expression<Func<T, TKey>> keySelector)
Parameters
Type Name Description
Expression<Func<T, TKey>> keySelector

Key selector expression of the subindex, see KeySelector.

Returns
Type Description
Subindex<T, TKey>

The new subindex added to its parent's Subindexes collection.

Type Parameters
Name Description
TKey

The type of the subindex key.

Add(LambdaExpression, bool, bool, IndexingAlgorithm, CultureInfo)

Creates a new subindex and attaches it to its parent's Subindexes collection.

Declaration
public Subindex<T> Add(LambdaExpression keySelector, bool keyIsUnique, bool onlyOnce, IndexingAlgorithm algorithm, CultureInfo locale)
Parameters
Type Name Description
LambdaExpression keySelector

Key selector expression of the subindex, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this subindex is unique for any given value of the parent key (default: false).

bool onlyOnce

Specifies whether it is required that the subindex does not exist prior to this method call. If a subindex with this keySelector already exists, an exception is thrown if it is true, and this method call is ignored if it is false.

IndexingAlgorithm algorithm

An IndexingAlgorithm used by the subindex. In the current version, only one algorithm is supported, RedBlackTree. Later versions may support other algorithms, such as bitmap or hash indexing.

CultureInfo locale

Locale information used to compare strings in the subindex (default: CultureInfo.CurrentCulture).

Returns
Type Description
Subindex<T>

The new subindex added to its parent's Subindexes collection.

Remarks

A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.

But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an InvalidOperationException.

For a subindex, uniqueness means that any given pair of parent key and subindex key values uniquely determines an item in the indexed collection.