Share via


Observable.Zip<TFirst, TSecond, TResult> Method (IObservable<TFirst>, IEnumerable<TSecond>, Func<TFirst, TSecond, TResult>)

Merges an observable sequence and an enumerable sequence into one observable sequence by using the selector function.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function Zip(Of TFirst, TSecond, TResult) ( _
    first As IObservable(Of TFirst), _
    second As IEnumerable(Of TSecond), _
    resultSelector As Func(Of TFirst, TSecond, TResult) _
) As IObservable(Of TResult)
'Usage
Dim first As IObservable(Of TFirst)
Dim second As IEnumerable(Of TSecond)
Dim resultSelector As Func(Of TFirst, TSecond, TResult)
Dim returnValue As IObservable(Of TResult)

returnValue = first.Zip(second, resultSelector)
public static IObservable<TResult> Zip<TFirst, TSecond, TResult>(
    this IObservable<TFirst> first,
    IEnumerable<TSecond> second,
    Func<TFirst, TSecond, TResult> resultSelector
)
[ExtensionAttribute]
public:
generic<typename TFirst, typename TSecond, typename TResult>
static IObservable<TResult>^ Zip(
    IObservable<TFirst>^ first, 
    IEnumerable<TSecond>^ second, 
    Func<TFirst, TSecond, TResult>^ resultSelector
)
static member Zip : 
        first:IObservable<'TFirst> * 
        second:IEnumerable<'TSecond> * 
        resultSelector:Func<'TFirst, 'TSecond, 'TResult> -> IObservable<'TResult> 
JScript does not support generic types and methods.

Type Parameters

  • TFirst
    The first type.
  • TSecond
    The second type.
  • TResult
    The type of result.

Parameters

  • resultSelector
    Type: System.Func<TFirst, TSecond, TResult>
    The function to invoke for each consecutive pair of elements from the first and second source.

Return Value

Type: System.IObservable<TResult>
An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IObservable<TFirst>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also

Reference

Observable Class

Zip Overload

System.Reactive.Linq Namespace