Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs')
-rw-r--r--Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs112
1 files changed, 112 insertions, 0 deletions
diff --git a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
index e20e3eb..8eb9289 100644
--- a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
+++ b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
@@ -544,6 +544,25 @@ namespace System.Reactive.Linq
return s_impl.SelectMany<TSource, TResult>(source, selector);
}
+ /// <summary>
+ /// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
+ /// </summary>
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+ /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
+ /// <param name="source">An observable sequence of elements to project.</param>
+ /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
+ /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
+ public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, IObservable<TResult>> selector)
+ {
+ if (source == null)
+ throw new ArgumentNullException("source");
+ if (selector == null)
+ throw new ArgumentNullException("selector");
+
+ return s_impl.SelectMany<TSource, TResult>(source, selector);
+ }
+
#if !NO_TPL
/// <summary>
/// Projects each element of an observable sequence to a task and merges all of the task results into one observable sequence.
@@ -609,6 +628,29 @@ namespace System.Reactive.Linq
return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
}
+ /// <summary>
+ /// Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
+ /// </summary>
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+ /// <typeparam name="TCollection">The type of the elements in the projected intermediate sequences.</typeparam>
+ /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
+ /// <param name="source">An observable sequence of elements to project.</param>
+ /// <param name="collectionSelector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
+ /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
+ /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="collectionSelector"/> or <paramref name="resultSelector"/> is null.</exception>
+ public static IObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, int, IObservable<TCollection>> collectionSelector, Func<TSource, int, TCollection, int, TResult> resultSelector)
+ {
+ if (source == null)
+ throw new ArgumentNullException("source");
+ if (collectionSelector == null)
+ throw new ArgumentNullException("collectionSelector");
+ if (resultSelector == null)
+ throw new ArgumentNullException("resultSelector");
+
+ return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
+ }
+
#if !NO_TPL
/// <summary>
/// Projects each element of an observable sequence to a task, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
@@ -685,6 +727,31 @@ namespace System.Reactive.Linq
}
/// <summary>
+ /// Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
+ /// </summary>
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+ /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
+ /// <param name="source">An observable sequence of notifications to project.</param>
+ /// <param name="onNext">A transform function to apply to each element; the second parameter represents the index of the source element.</param>
+ /// <param name="onError">A transform function to apply when an error occurs in the source sequence; the second parameter represents the index of the source element.</param>
+ /// <param name="onCompleted">A transform function to apply when the end of the source sequence is reached; the second parameter represents the number of elements observed.</param>
+ /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
+ public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, IObservable<TResult>> onNext, Func<Exception, int, IObservable<TResult>> onError, Func<int, IObservable<TResult>> onCompleted)
+ {
+ if (source == null)
+ throw new ArgumentNullException("source");
+ if (onNext == null)
+ throw new ArgumentNullException("onNext");
+ if (onError == null)
+ throw new ArgumentNullException("onError");
+ if (onCompleted == null)
+ throw new ArgumentNullException("onCompleted");
+
+ return s_impl.SelectMany<TSource, TResult>(source, onNext, onError, onCompleted);
+ }
+
+ /// <summary>
/// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
@@ -705,6 +772,27 @@ namespace System.Reactive.Linq
}
/// <summary>
+ /// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
+ /// The index of each source element is used in the projected form of that element.
+ /// </summary>
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+ /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam>
+ /// <param name="source">An observable sequence of elements to project.</param>
+ /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
+ /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
+ /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="Observable.ToObservable&lt;TSource&gt;(IEnumerable&lt;TSource&gt;)"/> conversion.</remarks>
+ public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, IEnumerable<TResult>> selector)
+ {
+ if (source == null)
+ throw new ArgumentNullException("source");
+ if (selector == null)
+ throw new ArgumentNullException("selector");
+
+ return s_impl.SelectMany<TSource, TResult>(source, selector);
+ }
+
+ /// <summary>
/// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
@@ -728,6 +816,30 @@ namespace System.Reactive.Linq
return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
}
+ /// <summary>
+ /// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
+ /// </summary>
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
+ /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
+ /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
+ /// <param name="source">An observable sequence of elements to project.</param>
+ /// <param name="collectionSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
+ /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
+ /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="collectionSelector"/> or <paramref name="resultSelector"/> is null.</exception>
+ /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="Observable.ToObservable&lt;TSource&gt;(IEnumerable&lt;TSource&gt;)"/> conversion.</remarks>
+ public static IObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, int, IEnumerable<TCollection>> collectionSelector, Func<TSource, int, TCollection, int, TResult> resultSelector)
+ {
+ if (source == null)
+ throw new ArgumentNullException("source");
+ if (collectionSelector == null)
+ throw new ArgumentNullException("collectionSelector");
+ if (resultSelector == null)
+ throw new ArgumentNullException("resultSelector");
+
+ return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
+ }
+
#endregion
#region + Skip +