Click or drag to resize
QueryableExUsingTSource, TResource Method (IQueryProvider, ExpressionFuncTResource, ExpressionFuncTResource, IEnumerableTSource)
Generates a sequence that's dependent on a resource object whose lifetime is determined by the sequence usage duration.

Namespace: System.Linq
Assembly: System.Interactive.Providers (in System.Interactive.Providers.dll) Version: 1.2.0.0
Syntax
C#
public static IQueryable<TSource> Using<TSource, TResource>(
	this IQueryProvider provider,
	Expression<Func<TResource>> resourceFactory,
	Expression<Func<TResource, IEnumerable<TSource>>> enumerableFactory
)
where TResource : IDisposable

Parameters

provider
Type: System.LinqIQueryProvider
Query provider.
resourceFactory
Type: System.Linq.ExpressionsExpressionFuncTResource
Resource factory function.
enumerableFactory
Type: System.Linq.ExpressionsExpressionFuncTResource, IEnumerableTSource
Enumerable factory function, having access to the obtained resource.

Type Parameters

TSource
Source element type.
TResource
Resource type.

Return Value

Type: IQueryableTSource
Sequence whose use controls the lifetime of the associated obtained resource.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also