Queryable::AsQueryable<TElement> Method (IEnumerable<TElement>^)

 

Converts a generic IEnumerable<T> to a generic IQueryable<T>.

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

public:
generic<typename TElement>
[ExtensionAttribute]
static IQueryable<TElement>^ AsQueryable(
	IEnumerable<TElement>^ source
)

Parameters

source
Type: System.Collections.Generic::IEnumerable<TElement>^

A sequence to convert.

Return Value

Type: System.Linq::IQueryable<TElement>^

An IQueryable<T> that represents the input sequence.

Type Parameters

TElement

The type of the elements of source.

Exception Condition
ArgumentNullException

source is null.

If the type of source implements IQueryable<T>, AsQueryable<TElement>(IEnumerable<TElement>^) returns it directly. Otherwise, it returns an IQueryable<T> that executes queries by calling the equivalent query operator methods in Enumerable instead of those in Queryable.

The following code example demonstrates how to use AsQueryable<TElement>(IEnumerable<TElement>^) to convert an IEnumerable<T> to an IQueryable<T>.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Windows Phone
Available since 8.1
Return to top
Show: