Class
QueryableExtensions

Holds extension methods for IQueryable.

Definition

Namespace:Telerik.Windows.Data

Assembly:Telerik.Windows.Data.dll

Syntax:

cs-api-definition
public static class QueryableExtensions

Inheritance: objectQueryableExtensions

Methods

Aggregate(IQueryable, AggregateFunction)

Calculates the results of a given aggregate function on a sequence of elements.

Declaration

cs-api-definition
public static AggregateResultCollection Aggregate(this IQueryable source, AggregateFunction aggregateFunction)

Parameters

source

IQueryable

An IQueryable whose elements will be used for aggregate calculation.

aggregateFunction

AggregateFunction

The aggregate function.

Returns

AggregateResultCollection

Collection of AggregateResults calculated for the function.

Aggregate(IQueryable, IEnumerable<AggregateFunction>)

Calculates the results of given aggregates functions on a sequence of elements.

Declaration

cs-api-definition
public static AggregateResultCollection Aggregate(this IQueryable source, IEnumerable<AggregateFunction> aggregateFunctions)

Parameters

source

IQueryable

An IQueryable whose elements will be used for aggregate calculation.

aggregateFunctions

IEnumerable<AggregateFunction>

The aggregate functions.

Returns

AggregateResultCollection

Collection of AggregateResults calculated for each function.

Count(IQueryable)

Returns the number of elements in a sequence.

Declaration

cs-api-definition
public static int Count(this IQueryable source)

Parameters

source

IQueryable

The IQueryable that contains the elements to be counted.

Returns

int

The number of elements in the input sequence.

Exceptions

ArgumentNullException

source is null.

ElementAt(IQueryable, int)

Returns the element at a specified index in a sequence.

Declaration

cs-api-definition
public static object ElementAt(this IQueryable source, int index)

Parameters

source

IQueryable

An IQueryable to return an element from.

index

int

The zero-based index of the element to retrieve.

Returns

object

The element at the specified position in source.

Exceptions

ArgumentNullException

source is null.

ArgumentOutOfRangeException

index is less than zero.

Except(IQueryable, IQueryable)

Produces the set difference of two sequences by using the default equality comparer to compare values.

Declaration

cs-api-definition
public static IQueryable Except(this IQueryable source1, IQueryable source2)

Parameters

source1

IQueryable

source2

IQueryable

Returns

IQueryable

First(IQueryable)

Returns the firsts item in a sequence.

Declaration

cs-api-definition
public static object First(this IQueryable source)

Parameters

source

IQueryable

The IQueryable that contains the elements to be counted.

Returns

object

First element.

GroupBy(IQueryable, IEnumerable<IGroupDescriptor>)

Groups the elements of a sequence according to a specified groupDescriptors.

Declaration

cs-api-definition
public static IQueryable GroupBy(this IQueryable source, IEnumerable<IGroupDescriptor> groupDescriptors)

Parameters

source

IQueryable

An IQueryable whose elements to group.

groupDescriptors

IEnumerable<IGroupDescriptor>

The group descriptors used for grouping.

Returns

IQueryable

An IQueryable with IGroup items, whose elements contains a sequence of objects and a key.

GroupBy(IQueryable, LambdaExpression)

Groups the elements of a sequence according to a specified key selector function.

Declaration

cs-api-definition
public static IQueryable GroupBy(this IQueryable source, LambdaExpression keySelector)

Parameters

source

IQueryable

An IQueryable whose elements to group.

keySelector

LambdaExpression

A function to extract the key for each element.

Returns

IQueryable

An IQueryable with IGrouping<TKey, TElement> items, whose elements contains a sequence of objects and a key.

OrderBy(IQueryable, LambdaExpression)

Sorts the elements of a sequence in ascending order according to a key.

Declaration

cs-api-definition
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector)

Parameters

source

IQueryable

A sequence of values to order.

keySelector

LambdaExpression

A function to extract a key from an element.

Returns

IQueryable

An IQueryable whose elements are sorted according to a key.

OrderBy(IQueryable, LambdaExpression, ListSortDirection?)

Declaration

cs-api-definition
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector, ListSortDirection? sortDirection)

Parameters

source

IQueryable

The source.

keySelector

LambdaExpression

The key selector.

sortDirection

ListSortDirection?

The sort direction.

Returns

IQueryable

An IQueryable whose elements are sorted according to a key.

OrderByDescending(IQueryable, LambdaExpression)

Sorts the elements of a sequence in descending order according to a key.

Declaration

cs-api-definition
public static IQueryable OrderByDescending(this IQueryable source, LambdaExpression keySelector)

Parameters

source

IQueryable

A sequence of values to order.

keySelector

LambdaExpression

A function to extract a key from an element.

Returns

IQueryable

An IQueryable whose elements are sorted in descending order according to a key.

Page(IQueryable, int, int)

Pages through the elements of a sequence until the specified pageIndex using pageSize.

Declaration

cs-api-definition
public static IQueryable Page(this IQueryable source, int pageIndex, int pageSize)

Parameters

source

IQueryable

A sequence of values to page.

pageIndex

int

Index of the page.

pageSize

int

Size of the page.

Returns

IQueryable

An IQueryable whose elements are at the specified pageIndex.

Select(IQueryable, IEnumerable<ISelectDescriptor>)

Selects a sequence of objects based on a IEnumerable of SelectDescriptor.

Declaration

cs-api-definition
public static IQueryable Select(this IQueryable source, IEnumerable<ISelectDescriptor> selectDescriptors)

Parameters

source

IQueryable

The source.

selectDescriptors

IEnumerable<ISelectDescriptor>

The select descriptor enumerable.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that will be projected according to the specified selectDescriptors.

Select(IQueryable, LambdaExpression)

Projects each element of a sequence into a new form.

Declaration

cs-api-definition
public static IQueryable Select(this IQueryable source, LambdaExpression selector)

Parameters

source

IQueryable

A sequence of values to project.

selector

LambdaExpression

A projection function to apply to each element.

Returns

IQueryable

An IQueryable whose elements are the result of invoking a projection selector on each element of source.

Select(IQueryable, SelectDescriptorCollection)

Selects a sequence of objects based on a SelectDescriptorCollection.

Declaration

cs-api-definition
public static IQueryable Select(this IQueryable source, SelectDescriptorCollection selectDescriptors)

Parameters

source

IQueryable

The source.

selectDescriptors

SelectDescriptorCollection

The select descriptor collection.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that will be projected according to the specified selectDescriptors.

Skip(IQueryable, int)

Bypasses a specified number of elements in a sequence and then returns the remaining elements.

Declaration

cs-api-definition
public static IQueryable Skip(this IQueryable source, int count)

Parameters

source

IQueryable

An IQueryable to return elements from.

count

int

The number of elements to skip before returning the remaining elements.

Returns

IQueryable

An IQueryable that contains elements that occur after the specified index in the input sequence.

Exceptions

ArgumentNullException

source is null.

Sort(IQueryable, IEnumerable<ISortDescriptor>)

Sorts the elements of a sequence using the specified sort descriptors.

Declaration

cs-api-definition
public static IQueryable Sort(this IQueryable source, IEnumerable<ISortDescriptor> sortDescriptors)

Parameters

source

IQueryable

A sequence of values to sort.

sortDescriptors

IEnumerable<ISortDescriptor>

The sort descriptors used for sorting.

Returns

IQueryable

An IQueryable whose elements are sorted according to a sortDescriptors.

Sort(IQueryable, IEnumerable<SortDescriptor>)

Sorts the elements of a sequence using the specified sort descriptors.

Declaration

cs-api-definition
public static IQueryable Sort(this IQueryable source, IEnumerable<SortDescriptor> sortDescriptors)

Parameters

source

IQueryable

A sequence of values to sort.

sortDescriptors

IEnumerable<SortDescriptor>

The sort descriptors used for sorting.

Returns

IQueryable

An IQueryable whose elements are sorted according to a sortDescriptors.

Sort(IQueryable, SortDescriptorCollection)

Sorts the elements of a sequence using the specified sort descriptors.

Declaration

cs-api-definition
public static IQueryable Sort(this IQueryable source, SortDescriptorCollection sortDescriptors)

Parameters

source

IQueryable

A sequence of values to sort.

sortDescriptors

SortDescriptorCollection

The sort descriptors used for sorting.

Returns

IQueryable

An IQueryable whose elements are sorted according to a sortDescriptors.

Take(IQueryable, int)

Returns a specified number of contiguous elements from the start of a sequence.

Declaration

cs-api-definition
public static IQueryable Take(this IQueryable source, int count)

Parameters

source

IQueryable

The sequence to return elements from.

count

int

The number of elements to return.

Returns

IQueryable

An IQueryable that contains the specified number of elements from the start of source.

Exceptions

ArgumentNullException

source is null.

ToIList(IQueryable)

Creates a IList<T> from an IQueryable where T is ElementType.

Declaration

cs-api-definition
public static IList ToIList(this IQueryable source)

Parameters

source

IQueryable

The IQueryable to create a List<T> from.

Returns

IList

A List<T> that contains elements from the input sequence.

Exceptions

ArgumentNullException

source is null.

ToIList<T>(IQueryable<T>)

Creates a IList<T> from an IQueryable where T is ElementType.

Declaration

cs-api-definition
public static IList<T> ToIList<T>(this IQueryable<T> source)

Parameters

source

IQueryable<T>

The IQueryable to create a List<T> from.

Returns

IList<T>

A List<T> that contains elements from the input sequence.

Exceptions

ArgumentNullException

source is null.

Union(IQueryable, IQueryable)

Produces the set union of two sequences by using the default equality comparer.

Declaration

cs-api-definition
public static IQueryable Union(this IQueryable source1, IQueryable source2)

Parameters

source1

IQueryable

source2

IQueryable

Returns

IQueryable

Where(IQueryable, CompositeFilterDescriptorCollection)

Filters a sequence of values based on a CompositeFilterDescriptorCollection.

Declaration

cs-api-definition
public static IQueryable Where(this IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)

Parameters

source

IQueryable

The source.

filterDescriptors

CompositeFilterDescriptorCollection

The composite filter descriptor collection.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that satisfy the conditions specified by the filterDescriptors.

Where(IQueryable, Expression)

Filters a sequence of values based on a predicate.

Declaration

cs-api-definition
public static IQueryable Where(this IQueryable source, Expression predicate)

Parameters

source

IQueryable

An IQueryable to filter.

predicate

Expression

A function to test each element for a condition.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that satisfy the condition specified by predicate.

Where(IQueryable, FilterDescriptorCollection)

Filters a sequence of values based on a collection of IFilterDescriptor.

Declaration

cs-api-definition
public static IQueryable Where(this IQueryable source, FilterDescriptorCollection filterDescriptors)

Parameters

source

IQueryable

The source.

filterDescriptors

FilterDescriptorCollection

The filter descriptors.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that satisfy the conditions specified by each filter descriptor in filterDescriptors.

Where(IQueryable, IEnumerable<IFilterDescriptor>)

Filters a sequence of values based on a collection of IFilterDescriptor.

Declaration

cs-api-definition
public static IQueryable Where(this IQueryable source, IEnumerable<IFilterDescriptor> filterDescriptors)

Parameters

source

IQueryable

The source.

filterDescriptors

IEnumerable<IFilterDescriptor>

The filter descriptors.

Returns

IQueryable

An IQueryable that contains elements from the input sequence that satisfy the conditions specified by each filter descriptor in filterDescriptors.