为可观测序列中的每个元素调用一个操作,并在可观测序列正常终止时调用一个操作。
Namespace:System.Reactive.Linq
装配: System.Reactive.dll) 中的 System.Reactive (
语法
'Declaration
<ExtensionAttribute> _
Public Shared Function Do(Of TSource) ( _
source As IObservable(Of TSource), _
onNext As Action(Of TSource), _
onCompleted As Action _
) As IObservable(Of TSource)
'Usage
Dim source As IObservable(Of TSource)
Dim onNext As Action(Of TSource)
Dim onCompleted As Action
Dim returnValue As IObservable(Of TSource)
returnValue = source.Do(onNext, onCompleted)
public static IObservable<TSource> Do<TSource>(
this IObservable<TSource> source,
Action<TSource> onNext,
Action onCompleted
)
[ExtensionAttribute]
public:
generic<typename TSource>
static IObservable<TSource>^ Do(
IObservable<TSource>^ source,
Action<TSource>^ onNext,
Action^ onCompleted
)
static member Do :
source:IObservable<'TSource> *
onNext:Action<'TSource> *
onCompleted:Action -> IObservable<'TSource>
JScript does not support generic types and methods.
类型参数
- TSource
源的类型
参数
- source
类型: System.IObservable<TSource>
源序列。
- onNext
类型: System.Action<TSource>
要针对可观测序列中的每个元素调用的操作。
- onCompleted
类型: System.Action
可观测序列正常终止时要调用的操作。
返回值
类型: System.IObservable<TSource>
应用了副作用行为的源序列。
使用说明
在 Visual Basic 和 C# 中,可以在 IObservable<TSource> 类型的任何对象上调用此方法作为实例方法。 当使用实例方法语法调用此方法时,请省略第一个参数。 有关详细信息,请参阅或。