[]
Filters the source collection based on a predicate.
public static IIndexedSource<T> Where<T>(this IIndexedSource<T> source, Expression<Func<T, bool>> predicate)
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. |
Type | Description |
---|---|
IIndexedSource<T> | An IIndexedSource<T> that contains elements from the input collection that satisfy the condition. |
Name | Description |
---|---|
T | The type of the elements of source. |
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.
Filters the source collection based on a predicate, preserving the order of the source collection.
public static IIndexedSource<T> Where<T>(this IIndexedSource<T> source, Expression<Func<T, bool>> predicate, bool preserveOriginalOrder)
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. |
Type | Description |
---|---|
IIndexedSource<T> | An IIndexedSource<T> that contains elements from the input collection that satisfy the condition. |
Name | Description |
---|---|
T | The type of the elements of source. |
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.