-
Notifications
You must be signed in to change notification settings - Fork 42
Generic Query Operations
Malcolm Groves edited this page Jan 10, 2014
·
3 revisions
FluentQuery supports the following operations when querying items from a generic collection (eg, a TDictionary<T>, or a TList<T>). Strictly speaking, this is anything that can supply a TEnumerator<T>:
Operation | Bound | Unbound | Terminating | Description |
---|---|---|---|---|
First | Yes | Yes | Enumerate the first item, ignoring the remainder. | |
From | Yes | From allows you to specify the source of the data you are querying. It is also From which transforms an Unbound Query into a Bound Query. | ||
Predicate | Yes | Yes | Returns a TPredicate<T> encapsulating the supplied Unbound Query logic. | |
Skip | Yes | Yes | Skip will bypass the specified number of items from the start of the enumeration, after which it will enumerate the remaining items as normal. | |
SkipWhile(Predicate) | Yes | Yes | SkipWhile will bypass items at the start of the enumeration while the supplied Predicate evaluates True. Once the Predicate evaluates false, all remaining items will be enumerated as normal. | |
SkipWhile(UnboundQuery) | Yes | Yes | SkipWhile will bypass items at the start of the enumeration that match the supplied Unbound Query. Once an item does not match the supplied query, all remaining items will be enumerated as normal. | |
Take | Yes | Yes | Take will enumerate up to the specified number of items, then ignore the remainder. | |
TakeWhile(Predicate) | Yes | Yes | TakeWhile will continue enumerating items while the supplied Predicate evaluates True, after which it will ignore the remaining items. | |
TakeWhile(UnboundQuery) | Yes | Yes | TakeWhile will continue enumerating items while they match the supplied Unbound Query, after which it will ignore the remaining items. | |
ToTList | Yes | Yes | Returns a new TList<T> containing the items that match the query | |
Where | Yes | Yes | Filter the items enumerated to only those that evaluate true when passed into the supplied Predicate | |
WhereNot(Predicate) | Yes | Yes | Filter the items enumerated to only those that evaluate false when passed into the supplied Predicate | |
WhereNot(UnboundQuery) | Yes | Yes | Filter the items enumerated to only those that do not match the supplied Unbound Query |