skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class QueryableExtensions

Holds extension methods for System.Linq.IQueryable.

Inheritance
System.Object
QueryableExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Data
Assembly: Telerik.Windows.Data.dll

Syntax

public static class QueryableExtensions

Methods

Aggregate(IQueryable, IEnumerable<AggregateFunction>)

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

Declaration
public static AggregateResultCollection Aggregate(this IQueryable source, IEnumerable<AggregateFunction> aggregateFunctions)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable whose elements will be used for aggregate calculation.

System.Collections.Generic.IEnumerable<AggregateFunction> aggregateFunctions

The aggregate functions.

Returns
AggregateResultCollection

Collection of AggregateResults calculated for each function.

Aggregate(IQueryable, AggregateFunction)

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

Declaration
public static AggregateResultCollection Aggregate(this IQueryable source, AggregateFunction aggregateFunction)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable whose elements will be used for aggregate calculation.

AggregateFunction aggregateFunction

The aggregate function.

Returns
AggregateResultCollection

Collection of AggregateResults calculated for the function.

Count(IQueryable)

Returns the number of elements in a sequence.

Declaration
public static int Count(this IQueryable source)
Parameters
System.Linq.IQueryable source

The System.Linq.IQueryable that contains the elements to be counted.

Returns
System.Int32

The number of elements in the input sequence.

Exceptions
System.ArgumentNullException

source is null.

ElementAt(IQueryable, Int32)

Returns the element at a specified index in a sequence.

Declaration
public static object ElementAt(this IQueryable source, int index)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable to return an element from.

System.Int32 index

The zero-based index of the element to retrieve.

Returns
System.Object

The element at the specified position in source.

Exceptions
System.ArgumentNullException

source is null.

System.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
public static IQueryable Except(this IQueryable source1, IQueryable source2)
Parameters
System.Linq.IQueryable source1

System.Linq.IQueryable source2

Returns
System.Linq.IQueryable

First(IQueryable)

Returns the firsts item in a sequence.

Declaration
public static object First(this IQueryable source)
Parameters
System.Linq.IQueryable source

The System.Linq.IQueryable that contains the elements to be counted.

Returns
System.Object

First element.

GroupBy(IQueryable, IEnumerable<IGroupDescriptor>)

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

Declaration
public static IQueryable GroupBy(this IQueryable source, IEnumerable<IGroupDescriptor> groupDescriptors)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable whose elements to group.

System.Collections.Generic.IEnumerable<IGroupDescriptor> groupDescriptors

The group descriptors used for grouping.

Returns
System.Linq.IQueryable

An System.Linq.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
public static IQueryable GroupBy(this IQueryable source, LambdaExpression keySelector)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable whose elements to group.

System.Linq.Expressions.LambdaExpression keySelector

A function to extract the key for each element.

Returns
System.Linq.IQueryable

An System.Linq.IQueryable with System.Linq.IGrouping<, > 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
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector)
Parameters
System.Linq.IQueryable source

A sequence of values to order.

System.Linq.Expressions.LambdaExpression keySelector

A function to extract a key from an element.

Returns
System.Linq.IQueryable

An System.Linq.IQueryable whose elements are sorted according to a key.

OrderBy(IQueryable, LambdaExpression, Nullable<ListSortDirection>)

Calls OrderBy(IQueryable, LambdaExpression) or OrderByDescending(IQueryable, LambdaExpression) depending on the sortDirection.

Declaration
public static IQueryable OrderBy(this IQueryable source, LambdaExpression keySelector, ListSortDirection? sortDirection)
Parameters
System.Linq.IQueryable source

The source.

System.Linq.Expressions.LambdaExpression keySelector

The key selector.

System.Nullable<System.ComponentModel.ListSortDirection> sortDirection

The sort direction.

Returns
System.Linq.IQueryable

An System.Linq.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
public static IQueryable OrderByDescending(this IQueryable source, LambdaExpression keySelector)
Parameters
System.Linq.IQueryable source

A sequence of values to order.

System.Linq.Expressions.LambdaExpression keySelector

A function to extract a key from an element.

Returns
System.Linq.IQueryable

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

Page(IQueryable, Int32, Int32)

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

Declaration
public static IQueryable Page(this IQueryable source, int pageIndex, int pageSize)
Parameters
System.Linq.IQueryable source

A sequence of values to page.

System.Int32 pageIndex

Index of the page.

System.Int32 pageSize

Size of the page.

Returns
System.Linq.IQueryable

An System.Linq.IQueryable whose elements are at the specified pageIndex.

Select(IQueryable, IEnumerable<ISelectDescriptor>)

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

Declaration
public static IQueryable Select(this IQueryable source, IEnumerable<ISelectDescriptor> selectDescriptors)
Parameters
System.Linq.IQueryable source

The source.

System.Collections.Generic.IEnumerable<ISelectDescriptor> selectDescriptors

The select descriptor enumerable.

Returns
System.Linq.IQueryable

An System.Linq.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
public static IQueryable Select(this IQueryable source, LambdaExpression selector)
Parameters
System.Linq.IQueryable source

A sequence of values to project.

System.Linq.Expressions.LambdaExpression selector

A projection function to apply to each element.

Returns
System.Linq.IQueryable

An System.Linq.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
public static IQueryable Select(this IQueryable source, SelectDescriptorCollection selectDescriptors)
Parameters
System.Linq.IQueryable source

The source.

SelectDescriptorCollection selectDescriptors

The select descriptor collection.

Returns
System.Linq.IQueryable

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

Skip(IQueryable, Int32)

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

Declaration
public static IQueryable Skip(this IQueryable source, int count)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable to return elements from.

System.Int32 count

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

Returns
System.Linq.IQueryable

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

Exceptions
System.ArgumentNullException

source is null.

Sort(IQueryable, IEnumerable<ISortDescriptor>)

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

Declaration
public static IQueryable Sort(this IQueryable source, IEnumerable<ISortDescriptor> sortDescriptors)
Parameters
System.Linq.IQueryable source

A sequence of values to sort.

System.Collections.Generic.IEnumerable<ISortDescriptor> sortDescriptors

The sort descriptors used for sorting.

Returns
System.Linq.IQueryable

An System.Linq.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
public static IQueryable Sort(this IQueryable source, IEnumerable<SortDescriptor> sortDescriptors)
Parameters
System.Linq.IQueryable source

A sequence of values to sort.

System.Collections.Generic.IEnumerable<SortDescriptor> sortDescriptors

The sort descriptors used for sorting.

Returns
System.Linq.IQueryable

An System.Linq.IQueryable whose elements are sorted according to a sortDescriptors.

Sort(IQueryable, SortDescriptorCollection)

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

Declaration
public static IQueryable Sort(this IQueryable source, SortDescriptorCollection sortDescriptors)
Parameters
System.Linq.IQueryable source

A sequence of values to sort.

SortDescriptorCollection sortDescriptors

The sort descriptors used for sorting.

Returns
System.Linq.IQueryable

An System.Linq.IQueryable whose elements are sorted according to a sortDescriptors.

Take(IQueryable, Int32)

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

Declaration
public static IQueryable Take(this IQueryable source, int count)
Parameters
System.Linq.IQueryable source

The sequence to return elements from.

System.Int32 count

The number of elements to return.

Returns
System.Linq.IQueryable

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

Exceptions
System.ArgumentNullException

source is null.

ToIList(IQueryable)

Creates a System.Collections.Generic.IList<T> from an System.Linq.IQueryable where T is System.Linq.IQueryable.ElementType.

Declaration
public static IList ToIList(this IQueryable source)
Parameters
System.Linq.IQueryable source

The System.Linq.IQueryable to create a System.Collections.Generic.List<T> from.

Returns
System.Collections.IList

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

Exceptions
System.ArgumentNullException

source is null.

ToIList<T>(IQueryable<T>)

Creates a System.Collections.Generic.IList<T> from an System.Linq.IQueryable where T is System.Linq.IQueryable.ElementType.

Declaration
public static IList<T> ToIList<T>(this IQueryable<T> source)
Parameters
System.Linq.IQueryable<T> source

The System.Linq.IQueryable to create a System.Collections.Generic.List<T> from.

Returns
System.Collections.Generic.IList<T>

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

Type Parameters
T

Exceptions
System.ArgumentNullException

source is null.

Union(IQueryable, IQueryable)

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

Declaration
public static IQueryable Union(this IQueryable source1, IQueryable source2)
Parameters
System.Linq.IQueryable source1

System.Linq.IQueryable source2

Returns
System.Linq.IQueryable

Where(IQueryable, IEnumerable<IFilterDescriptor>)

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

Declaration
public static IQueryable Where(this IQueryable source, IEnumerable<IFilterDescriptor> filterDescriptors)
Parameters
System.Linq.IQueryable source

The source.

System.Collections.Generic.IEnumerable<IFilterDescriptor> filterDescriptors

The filter descriptors.

Returns
System.Linq.IQueryable

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

Where(IQueryable, Expression)

Filters a sequence of values based on a predicate.

Declaration
public static IQueryable Where(this IQueryable source, Expression predicate)
Parameters
System.Linq.IQueryable source

An System.Linq.IQueryable to filter.

System.Linq.Expressions.Expression predicate

A function to test each element for a condition.

Returns
System.Linq.IQueryable

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

Where(IQueryable, CompositeFilterDescriptorCollection)

Filters a sequence of values based on a CompositeFilterDescriptorCollection.

Declaration
public static IQueryable Where(this IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
Parameters
System.Linq.IQueryable source

The source.

CompositeFilterDescriptorCollection filterDescriptors

The composite filter descriptor collection.

Returns
System.Linq.IQueryable

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

Where(IQueryable, FilterDescriptorCollection)

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

Declaration
public static IQueryable Where(this IQueryable source, FilterDescriptorCollection filterDescriptors)
Parameters
System.Linq.IQueryable source

The source.

FilterDescriptorCollection filterDescriptors

The filter descriptors.

Returns
System.Linq.IQueryable

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

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.