[]
        
(Showing Draft Content)

C1.LiveLinq.Indexing.ScannerCollection-1.Add

Add Method

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

Creates a new index and adds it to the collection of indexes.

Declaration
public IIndexScanner<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 index, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this index is a unique key for the indexed collection (default: false).

bool onlyOnce

Specifies whether it is required that the index does not exist prior to this method call (default: false). If an index 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 index. In the current version, only one algorithm is supported, RedBlackTree. Later versions may support other algorithms, such as bitmap or hash indexes.

CultureInfo locale

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

Returns
Type Description
IIndexScanner<T, TKey>

The new index added to the collection of indexes.

Type Parameters
Name Description
TKey

The type of the index 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.

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

Creates a new index and adds it to the collection of indexes.

Declaration
public IIndexScanner<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 index, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this index is a unique key for the indexed collection (default: false).

bool onlyOnce

Specifies whether it is required that the index does not exist prior to this method call (default: false). If an index 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 index (default: CultureInfo.CurrentCulture).

Returns
Type Description
IIndexScanner<T, TKey>

The new index added to the collection of indexes.

Type Parameters
Name Description
TKey

The type of the index 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.

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

Creates a new index and adds it to the collection of indexes.

Declaration
public IIndexScanner<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 index, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this index is a unique key for the indexed collection (default: false).

bool onlyOnce

Specifies whether it is required that the index does not exist prior to this method call (default: false). If an index 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
IIndexScanner<T, TKey>

The new index added to the collection of indexes.

Type Parameters
Name Description
TKey

The type of the index 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.

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

Creates a new index and adds it to the collection of indexes.

Declaration
public IIndexScanner<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 index, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this index is a unique key for the indexed collection (default: false).

Returns
Type Description
IIndexScanner<T, TKey>

The new index added to the collection of indexes.

Type Parameters
Name Description
TKey

The type of the index 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.

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

Creates a new index and adds it to the collection of indexes.

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

Key selector expression of the index, see KeySelector.

Returns
Type Description
IIndexScanner<T, TKey>

The new index added to the collection of indexes.

Type Parameters
Name Description
TKey

The type of the index key.

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

Creates a new index and adds it to the collection of indexes.

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

Key selector expression of the index, see KeySelector.

bool keyIsUnique

Specifies whether the key used in this index is a unique key for the indexed collection (default: false).

bool onlyOnce

Specifies whether it is required that the index does not exist prior to this method call. If an index 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 index. In the current version, only one algorithm is supported, RedBlackTree. Later versions may support other algorithms, such as bitmap or hash indexes.

CultureInfo locale

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

Returns
Type Description
IIndexScanner<T>

The new index added to the collection of indexes.

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.