Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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:
© 2017 Microsoft