IQueryProvider.CreateQuery<TElement> Method (Expression)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Constructs an IQueryable<T> object that can evaluate the query represented by a specified expression tree.

Namespace:  System.Linq
Assembly:  System.Core (in System.Core.dll)


Function CreateQuery(Of TElement) ( _
    expression As Expression _
) As IQueryable(Of TElement)
IQueryable<TElement> CreateQuery<TElement>(
    Expression expression

Type Parameters

  • TElement
    The type of the elements of the IQueryable<T> that is returned.


Return Value

Type: System.Linq.IQueryable<TElement>
An IQueryable<T> that can evaluate the query represented by the specified expression tree.



The Expression property of the returned IQueryable<T> object is equal to expression.

The CreateQuery method is used to create new IQueryable<T> objects, given an expression tree. The query that is represented by the returned object is associated with a specific LINQ provider.

Most of the Queryable standard query operator methods that return enumerable results call this method. They pass it a MethodCallExpression that represents a LINQ query.

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.