Skip to content

Generic Query Operations

Malcolm Groves edited this page Jan 9, 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.
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 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.
Take Yes Yes Take will enumerate up to the specified number of items, then ignore the remainder.
TakeWhile Yes Yes TakeWhile will continue enumerating items while the supplied Predicate evaluates True, 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

Clone this wiki locally