QueryableExtensions
Holds extension methods for IQueryable.
Definition
Namespace:Telerik.Windows.Data
Assembly:Telerik.Windows.Data.dll
Syntax:
public static class QueryableExtensions
Inheritance: objectQueryableExtensions
Methods
Calculates the results of a given aggregate function on a sequence of elements.
public static AggregateResultCollection Aggregate(this IQueryable source, AggregateFunction aggregateFunction)
An IQueryable whose elements will be used for aggregate calculation.
aggregateFunctionAggregateFunctionThe aggregate function.
Returns:Collection of AggregateResults calculated for the function.
Calculates the results of given aggregates functions on a sequence of elements.
public static AggregateResultCollection Aggregate(this IQueryable source, IEnumerable<AggregateFunction> aggregateFunctions)
An IQueryable whose elements will be used for aggregate calculation.
aggregateFunctionsIEnumerable<AggregateFunction>The aggregate functions.
Returns:Collection of AggregateResults calculated for each function.
Returns the number of elements in a sequence.
public static int Count(this IQueryable source)
The IQueryable that contains the elements to be counted.
Returns:The number of elements in the input sequence.
Exceptions:source is null.
Returns the element at a specified index in a sequence.
public static object ElementAt(this IQueryable source, int index)
An IQueryable to return an element from.
indexintThe zero-based index of the element to retrieve.
Returns:The element at the specified position in source.
source is null.
index is less than zero.
Produces the set difference of two sequences by using the default equality comparer to compare values.
public static IQueryable Except(this IQueryable source1, IQueryable source2)
Returns the firsts item in a sequence.
public static object First(this IQueryable source)
The IQueryable that contains the elements to be counted.
Returns:First element.
Groups the elements of a sequence according to a specified groupDescriptors.
public static IQueryable GroupBy(this IQueryable source, IEnumerable<IGroupDescriptor> groupDescriptors)
An IQueryable whose elements to group.
groupDescriptorsIEnumerable<IGroupDescriptor>The group descriptors used for grouping.
Returns:An IQueryable with IGroup items, whose elements contains a sequence of objects and a key.
Groups the elements of a sequence according to a specified key selector function.
public static IQueryable GroupBy(this IQueryable source, LambdaExpression keySelector)
An IQueryable whose elements to group.
keySelectorLambdaExpressionA function to extract the key for each element.
Returns:An IQueryable with IGrouping<TKey, TElement> items, whose elements contains a sequence of objects and a key.
Calls OrderBy(IQueryable, LambdaExpression)
or OrderByDescending(IQueryable, LambdaExpression) depending on the sortDirection.
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector, ListSortDirection? sortDirection)
The source.
keySelectorLambdaExpressionThe key selector.
sortDirectionListSortDirection?The sort direction.
Returns:An IQueryable whose elements are sorted according to a key.
Sorts the elements of a sequence in ascending order according to a key.
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector)
A sequence of values to order.
keySelectorLambdaExpressionA function to extract a key from an element.
Returns:An IQueryable whose elements are sorted according to a key.
Sorts the elements of a sequence in descending order according to a key.
public static IQueryable OrderByDescending(this IQueryable source, LambdaExpression keySelector)
A sequence of values to order.
keySelectorLambdaExpressionA function to extract a key from an element.
Returns:An IQueryable whose elements are sorted in descending order according to a key.
Pages through the elements of a sequence until the specified
pageIndex using pageSize.
public static IQueryable Page(this IQueryable source, int pageIndex, int pageSize)
A sequence of values to page.
pageIndexintIndex of the page.
pageSizeintSize of the page.
Returns:An IQueryable whose elements are at the specified pageIndex.
Selects a sequence of objects based on a IEnumerable of SelectDescriptor.
public static IQueryable Select(this IQueryable source, IEnumerable<ISelectDescriptor> selectDescriptors)
The source.
selectDescriptorsIEnumerable<ISelectDescriptor>The select descriptor enumerable.
Returns:An IQueryable that contains elements from the input sequence
that will be projected according to the specified selectDescriptors.
Projects each element of a sequence into a new form.
public static IQueryable Select(this IQueryable source, LambdaExpression selector)
A sequence of values to project.
selectorLambdaExpressionA projection function to apply to each element.
Returns:An IQueryable whose elements are the result of invoking a
projection selector on each element of source.
Selects a sequence of objects based on a SelectDescriptorCollection.
public static IQueryable Select(this IQueryable source, SelectDescriptorCollection selectDescriptors)
The source.
selectDescriptorsSelectDescriptorCollectionThe select descriptor collection.
Returns:An IQueryable that contains elements from the input sequence
that will be projected according to the specified selectDescriptors.
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
public static IQueryable Skip(this IQueryable source, int count)
An IQueryable to return elements from.
countintThe number of elements to skip before returning the remaining elements.
Returns:An IQueryable that contains elements that occur after the specified index in the input sequence.
Exceptions:source is null.
Sorts the elements of a sequence using the specified sort descriptors.
public static IQueryable Sort(this IQueryable source, IEnumerable<ISortDescriptor> sortDescriptors)
A sequence of values to sort.
sortDescriptorsIEnumerable<ISortDescriptor>The sort descriptors used for sorting.
Returns:An IQueryable whose elements are sorted according to a sortDescriptors.
Sorts the elements of a sequence using the specified sort descriptors.
public static IQueryable Sort(this IQueryable source, IEnumerable<SortDescriptor> sortDescriptors)
A sequence of values to sort.
sortDescriptorsIEnumerable<SortDescriptor>The sort descriptors used for sorting.
Returns:An IQueryable whose elements are sorted according to a sortDescriptors.
Sorts the elements of a sequence using the specified sort descriptors.
public static IQueryable Sort(this IQueryable source, SortDescriptorCollection sortDescriptors)
A sequence of values to sort.
sortDescriptorsSortDescriptorCollectionThe sort descriptors used for sorting.
Returns:An IQueryable whose elements are sorted according to a sortDescriptors.
Returns a specified number of contiguous elements from the start of a sequence.
public static IQueryable Take(this IQueryable source, int count)
The sequence to return elements from.
countintThe number of elements to return.
Returns:An IQueryable that contains the specified number
of elements from the start of source.
source is null.
Creates a IList<T> from an IQueryable where T is ElementType.
public static IList ToIList(this IQueryable source)
The IQueryable to create a List<T> from.
Returns:A List<T> that contains elements from the input sequence.
Exceptions:source is null.
Creates a IList<T> from an IQueryable where T is ElementType.
public static IList<T> ToIList<T>(this IQueryable<T> source)
The IQueryable to create a List<T> from.
Returns:IList<T>
A List<T> that contains elements from the input sequence.
Exceptions:source is null.
Produces the set union of two sequences by using the default equality comparer.
public static IQueryable Union(this IQueryable source1, IQueryable source2)
Filters a sequence of values based on a CompositeFilterDescriptorCollection.
public static IQueryable Where(this IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
The source.
filterDescriptorsCompositeFilterDescriptorCollectionThe composite filter descriptor collection.
Returns:An IQueryable that contains elements from the input sequence
that satisfy the conditions specified by the filterDescriptors.
Filters a sequence of values based on a predicate.
public static IQueryable Where(this IQueryable source, Expression predicate)
An IQueryable to filter.
predicateExpressionA function to test each element for a condition.
Returns:An IQueryable that contains elements from the input sequence
that satisfy the condition specified by predicate.
Filters a sequence of values based on a collection of IFilterDescriptor.
public static IQueryable Where(this IQueryable source, FilterDescriptorCollection filterDescriptors)
The source.
filterDescriptorsFilterDescriptorCollectionThe filter descriptors.
Returns:An IQueryable that contains elements from the input sequence
that satisfy the conditions specified by each filter descriptor in filterDescriptors.
Filters a sequence of values based on a collection of IFilterDescriptor.
public static IQueryable Where(this IQueryable source, IEnumerable<IFilterDescriptor> filterDescriptors)
The source.
filterDescriptorsIEnumerable<IFilterDescriptor>The filter descriptors.
Returns:An IQueryable that contains elements from the input sequence
that satisfy the conditions specified by each filter descriptor in filterDescriptors.