[]
        
(Showing Draft Content)

C1.LiveLinq.IndexedQueryExtensions.Where

Where Method

Where<T>(IIndexedSource<T>, Expression<Func<T, bool>>)

Filters the source collection based on a predicate.

Declaration
public static IIndexedSource<T> Where<T>(this IIndexedSource<T> source, Expression<Func<T, bool>> predicate)
Parameters
Type Name Description
IIndexedSource<T> source

An IIndexedSource<T> to filter.

Expression<Func<T, bool>> predicate

A function to test each element for a condition.

Returns
Type Description
IIndexedSource<T>

An IIndexedSource<T> that contains elements from the input collection that satisfy the condition.

Type Parameters
Name Description
T

The type of the elements of source.

Remarks

If an index is used to optimized performance of this operation, the resulting collection may not be in the same order as the source collection. If you need to preserve the order, use the other overload of the Where operator. It will still be optimized, albeit to a lesser degree.

Where<T>(IIndexedSource<T>, Expression<Func<T, bool>>, bool)

Filters the source collection based on a predicate, preserving the order of the source collection.

Declaration
public static IIndexedSource<T> Where<T>(this IIndexedSource<T> source, Expression<Func<T, bool>> predicate, bool preserveOriginalOrder)
Parameters
Type Name Description
IIndexedSource<T> source

An IIndexedSource<T> to filter.

Expression<Func<T, bool>> predicate

A function to test each element for a condition.

bool preserveOriginalOrder

Specifies whether the source order must be preserved in the result.

Returns
Type Description
IIndexedSource<T>

An IIndexedSource<T> that contains elements from the input collection that satisfy the condition.

Type Parameters
Name Description
T

The type of the elements of source.

Remarks

Preserving the order can lessen the effect of performance optimization using an index. Use this overload only if preserving the order in this operation is essential.