Observable.Using < TSource, TResource > 方法
建構相依于資源物件的可觀察序列。
Namespace:System.Reactive.Linq
裝配: System.Reactive.dll) 中的 System.Reactive (
Syntax
'Declaration
Public Shared Function Using(Of TSource, TResource As IDisposable) ( _
resourceFactory As Func(Of TResource), _
observableFactory As Func(Of TResource, IObservable(Of TSource)) _
) As IObservable(Of TSource)
'Usage
Dim resourceFactory As Func(Of TResource)
Dim observableFactory As Func(Of TResource, IObservable(Of TSource))
Dim returnValue As IObservable(Of TSource)
returnValue = Observable.Using(resourceFactory, _
observableFactory)
public static IObservable<TSource> Using<TSource, TResource>(
Func<TResource> resourceFactory,
Func<TResource, IObservable<TSource>> observableFactory
)
where TResource : IDisposable
public:
generic<typename TSource, typename TResource>
where TResource : IDisposable
static IObservable<TSource>^ Using(
Func<TResource>^ resourceFactory,
Func<TResource, IObservable<TSource>^>^ observableFactory
)
static member Using :
resourceFactory:Func<'TResource> *
observableFactory:Func<'TResource, IObservable<'TSource>> -> IObservable<'TSource> when 'TResource : IDisposable
JScript does not support generic types and methods.
類型參數
- TSource
來源的類型。
- TResource
資源的型別。
參數
- resourceFactory
類型:System.Func< TResource>
取得資源物件的 Factory 函式。
- observableFactory
類型:System.Func< TResource、IObservable< TSource>>
要取得相依于所取得資源的可觀察序列的 Factory 函式。
傳回值
類型:System.IObservable< TSource>
可觀察序列,其存留期控制相依資源物件的存留期。