// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT License.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Reactive.Threading.Tasks; // needed for doc comments
using System.Threading;
using System.Threading.Tasks;
namespace System.Reactive.Linq
{
public static partial class Observable
{
#region + Cast +
///
/// Converts the elements of an observable sequence to the specified type.
///
/// The type to convert the elements in the source sequence to.
/// The observable sequence that contains the elements to be converted.
/// An observable sequence that contains each element of the source sequence converted to the specified type.
/// is null.
public static IObservable Cast(this IObservable source)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
return s_impl.Cast(source);
}
#endregion
#region + DefaultIfEmpty +
///
/// Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty.
///
/// The type of the elements in the source sequence (if any), whose default value will be taken if the sequence is empty.
/// The sequence to return a default value for if it is empty.
/// An observable sequence that contains the default value for the TSource type if the source is empty; otherwise, the elements of the source itself.
/// is null.
public static IObservable DefaultIfEmpty(this IObservable source)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
return s_impl.DefaultIfEmpty(source);
}
///
/// Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
///
/// The type of the elements in the source sequence (if any), and the specified default value which will be taken if the sequence is empty.
/// The sequence to return the specified value for if it is empty.
/// The value to return if the sequence is empty.
/// An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
/// is null.
public static IObservable DefaultIfEmpty(this IObservable source, TSource defaultValue)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
return s_impl.DefaultIfEmpty(source, defaultValue);
}
#endregion
#region + Distinct +
///
/// Returns an observable sequence that contains only distinct elements.
///
/// The type of the elements in the source sequence.
/// An observable sequence to retain distinct elements for.
/// An observable sequence only containing the distinct elements from the source sequence.
/// is null.
/// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
public static IObservable Distinct(this IObservable source)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
return s_impl.Distinct(source);
}
///
/// Returns an observable sequence that contains only distinct elements according to the comparer.
///
/// The type of the elements in the source sequence.
/// An observable sequence to retain distinct elements for.
/// Equality comparer for source elements.
/// An observable sequence only containing the distinct elements from the source sequence.
/// or is null.
/// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
public static IObservable Distinct(this IObservable source, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.Distinct(source, comparer);
}
///
/// Returns an observable sequence that contains only distinct elements according to the keySelector.
///
/// The type of the elements in the source sequence.
/// The type of the discriminator key computed for each element in the source sequence.
/// An observable sequence to retain distinct elements for.
/// A function to compute the comparison key for each element.
/// An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
/// or is null.
/// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
public static IObservable Distinct(this IObservable source, Func keySelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
return s_impl.Distinct(source, keySelector);
}
///
/// Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
///
/// The type of the elements in the source sequence.
/// The type of the discriminator key computed for each element in the source sequence.
/// An observable sequence to retain distinct elements for.
/// A function to compute the comparison key for each element.
/// Equality comparer for source elements.
/// An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
/// or or is null.
/// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
public static IObservable Distinct(this IObservable source, Func keySelector, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.Distinct(source, keySelector, comparer);
}
#endregion
#region + GroupBy +
///
/// Groups the elements of an observable sequence according to a specified key selector function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or is null.
public static IObservable> GroupBy(this IObservable source, Func keySelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
return s_impl.GroupBy(source, keySelector);
}
///
/// Groups the elements of an observable sequence according to a specified key selector function and comparer.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// An equality comparer to compare keys with.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or is null.
public static IObservable> GroupBy(this IObservable source, Func keySelector, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupBy(source, keySelector, comparer);
}
///
/// Groups the elements of an observable sequence and selects the resulting elements by using a specified function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or is null.
public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
return s_impl.GroupBy(source, keySelector, elementSelector);
}
///
/// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// An equality comparer to compare keys with.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or or is null.
public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupBy(source, keySelector, elementSelector, comparer);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// The initial number of elements that the underlying dictionary can contain.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or is null.
/// is less than 0.
public static IObservable> GroupBy(this IObservable source, Func keySelector, int capacity)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
return s_impl.GroupBy(source, keySelector, capacity);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// The initial number of elements that the underlying dictionary can contain.
/// An equality comparer to compare keys with.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or is null.
/// is less than 0.
public static IObservable> GroupBy(this IObservable source, Func keySelector, int capacity, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupBy(source, keySelector, capacity, comparer);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity and selects the resulting elements by using a specified function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// The initial number of elements that the underlying dictionary can contain.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or is null.
/// is less than 0.
public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, int capacity)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
return s_impl.GroupBy(source, keySelector, elementSelector, capacity);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// The initial number of elements that the underlying dictionary can contain.
/// An equality comparer to compare keys with.
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// or or or is null.
/// is less than 0.
public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, int capacity, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupBy(source, keySelector, elementSelector, capacity, comparer);
}
#endregion
#region + GroupByUntil +
///
/// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// A function to signal the expiration of a group.
/// An equality comparer to compare keys with.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or or is null.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func elementSelector, Func, IObservable> durationSelector, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupByUntil(source, keySelector, elementSelector, durationSelector, comparer);
}
///
/// Groups the elements of an observable sequence according to a specified key selector function and selects the resulting elements by using a specified function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// A function to signal the expiration of a group.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or is null.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func elementSelector, Func, IObservable> durationSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
return s_impl.GroupByUntil(source, keySelector, elementSelector, durationSelector);
}
///
/// Groups the elements of an observable sequence according to a specified key selector function and comparer.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to signal the expiration of a group.
/// An equality comparer to compare keys with.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or is null.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func, IObservable> durationSelector, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupByUntil(source, keySelector, durationSelector, comparer);
}
///
/// Groups the elements of an observable sequence according to a specified key selector function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to signal the expiration of a group.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or is null.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func, IObservable> durationSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
return s_impl.GroupByUntil(source, keySelector, durationSelector);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// A function to signal the expiration of a group.
/// The initial number of elements that the underlying dictionary can contain.
/// An equality comparer to compare keys with.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or or is null.
/// is less than 0.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func elementSelector, Func, IObservable> durationSelector, int capacity, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupByUntil(source, keySelector, elementSelector, durationSelector, capacity, comparer);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and selects the resulting elements by using a specified function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements within the groups computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to map each source element to an element in an observable group.
/// A function to signal the expiration of a group.
/// The initial number of elements that the underlying dictionary can contain.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or is null.
/// is less than 0.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func elementSelector, Func, IObservable> durationSelector, int capacity)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (elementSelector == null)
{
throw new ArgumentNullException(nameof(elementSelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
return s_impl.GroupByUntil(source, keySelector, elementSelector, durationSelector, capacity);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to signal the expiration of a group.
/// The initial number of elements that the underlying dictionary can contain.
/// An equality comparer to compare keys with.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or or is null.
/// is less than 0.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func, IObservable> durationSelector, int capacity, IEqualityComparer comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return s_impl.GroupByUntil(source, keySelector, durationSelector, capacity, comparer);
}
///
/// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
/// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
/// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
///
/// The type of the elements in the source sequence.
/// The type of the grouping key computed for each element in the source sequence.
/// The type of the elements in the duration sequences obtained for each group to denote its lifetime.
/// An observable sequence whose elements to group.
/// A function to extract the key for each element.
/// A function to signal the expiration of a group.
/// The initial number of elements that the underlying dictionary can contain.
///
/// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
///
/// or or is null.
/// is less than 0.
public static IObservable> GroupByUntil(this IObservable source, Func keySelector, Func, IObservable> durationSelector, int capacity)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (keySelector == null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (durationSelector == null)
{
throw new ArgumentNullException(nameof(durationSelector));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity));
}
return s_impl.GroupByUntil(source, keySelector, durationSelector, capacity);
}
#endregion
#region + GroupJoin +
///
/// Correlates the elements of two sequences based on overlapping durations, and groups the results.
///
/// The type of the elements in the left source sequence.
/// The type of the elements in the right source sequence.
/// The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.
/// The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.
/// The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.
/// The left observable sequence to join elements for.
/// The right observable sequence to join elements for.
/// A function to select the duration of each element of the left observable sequence, used to determine overlap.
/// A function to select the duration of each element of the right observable sequence, used to determine overlap.
/// A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence.
/// An observable sequence that contains result elements computed from source elements that have an overlapping duration.
/// or or or or is null.
public static IObservable GroupJoin(this IObservable left, IObservable right, Func> leftDurationSelector, Func> rightDurationSelector, Func, TResult> resultSelector)
{
if (left == null)
{
throw new ArgumentNullException(nameof(left));
}
if (right == null)
{
throw new ArgumentNullException(nameof(right));
}
if (leftDurationSelector == null)
{
throw new ArgumentNullException(nameof(leftDurationSelector));
}
if (rightDurationSelector == null)
{
throw new ArgumentNullException(nameof(rightDurationSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.GroupJoin(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
}
#endregion
#region + Join +
///
/// Correlates the elements of two sequences based on overlapping durations.
///
/// The type of the elements in the left source sequence.
/// The type of the elements in the right source sequence.
/// The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.
/// The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.
/// The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.
/// The left observable sequence to join elements for.
/// The right observable sequence to join elements for.
/// A function to select the duration of each element of the left observable sequence, used to determine overlap.
/// A function to select the duration of each element of the right observable sequence, used to determine overlap.
/// A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences.
/// An observable sequence that contains result elements computed from source elements that have an overlapping duration.
/// or or or or is null.
public static IObservable Join(this IObservable left, IObservable right, Func> leftDurationSelector, Func> rightDurationSelector, Func resultSelector)
{
if (left == null)
{
throw new ArgumentNullException(nameof(left));
}
if (right == null)
{
throw new ArgumentNullException(nameof(right));
}
if (leftDurationSelector == null)
{
throw new ArgumentNullException(nameof(leftDurationSelector));
}
if (rightDurationSelector == null)
{
throw new ArgumentNullException(nameof(rightDurationSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.Join(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
}
#endregion
#region + OfType +
///
/// Filters the elements of an observable sequence based on the specified type.
///
/// The type to filter the elements in the source sequence on.
/// The observable sequence that contains the elements to be filtered.
/// An observable sequence that contains elements from the input sequence of type TResult.
/// is null.
public static IObservable OfType(this IObservable source)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
return s_impl.OfType(source);
}
#endregion
#region + Select +
///
/// Projects each element of an observable sequence into a new form.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.
/// A sequence of elements to invoke a transform function on.
/// A transform function to apply to each source element.
/// An observable sequence whose elements are the result of invoking the transform function on each element of source.
/// or is null.
public static IObservable Select(this IObservable source, Func selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.Select(source, selector);
}
///
/// Projects each element of an observable sequence into a new form by incorporating the element's index.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.
/// A sequence of elements to invoke a transform function on.
/// A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of invoking the transform function on each element of source.
/// or is null.
public static IObservable Select(this IObservable source, Func selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.Select(source, selector);
}
#endregion
#region + SelectMany +
///
/// Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the other sequence and the elements in the result sequence.
/// An observable sequence of elements to project.
/// An observable sequence to project each element from the source sequence onto.
/// An observable sequence whose elements are the result of projecting each source element onto the other sequence and merging all the resulting sequences together.
/// or is null.
public static IObservable SelectMany(this IObservable source, IObservable other)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
return s_impl.SelectMany(source, other);
}
///
/// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner sequences and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner sequences and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to a task and merges all of the task results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the result produced by the projected tasks and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.
/// This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to a task by incorporating the element's index and merges all of the task results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the result produced by the projected tasks and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.
/// This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to a task with cancellation support and merges all of the task results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the result produced by the projected tasks and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.
/// This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to a task by incorporating the element's index with cancellation support and merges all of the task results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the result produced by the projected tasks and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.
/// This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
/// or is null.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// 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.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected intermediate sequences.
/// 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.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// A transform function to apply to each element of the intermediate sequence.
/// 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.
/// or or is null.
public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (collectionSelector == null)
{
throw new ArgumentNullException(nameof(collectionSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, collectionSelector, resultSelector);
}
///
/// Projects each element of an observable sequence to an observable sequence by incorporating the element's index, 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.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected intermediate sequences.
/// 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.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element and the fourth parameter represents the index of the intermediate element.
/// 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.
/// or or is null.
public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (collectionSelector == null)
{
throw new ArgumentNullException(nameof(collectionSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, collectionSelector, resultSelector);
}
///
/// 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.
///
/// The type of the elements in the source sequence.
/// The type of the results produced by the projected intermediate tasks.
/// The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// A transform function to apply to each element of the intermediate sequence.
/// An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.
/// or or is null.
/// This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
public static IObservable SelectMany(this IObservable source, Func> taskSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (taskSelector == null)
{
throw new ArgumentNullException(nameof(taskSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, taskSelector, resultSelector);
}
///
/// Projects each element of an observable sequence to a task by incorporating the element's index, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the results produced by the projected intermediate tasks.
/// The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.
/// or or is null.
/// This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
public static IObservable SelectMany(this IObservable source, Func> taskSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (taskSelector == null)
{
throw new ArgumentNullException(nameof(taskSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, taskSelector, resultSelector);
}
///
/// Projects each element of an observable sequence to a task with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the results produced by the projected intermediate tasks.
/// The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// A transform function to apply to each element of the intermediate sequence.
/// An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.
/// or or is null.
/// This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
public static IObservable SelectMany(this IObservable source, Func> taskSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (taskSelector == null)
{
throw new ArgumentNullException(nameof(taskSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, taskSelector, resultSelector);
}
///
/// Projects each element of an observable sequence to a task by incorporating the element's index with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the results produced by the projected intermediate tasks.
/// The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.
/// or or is null.
/// This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using .
public static IObservable SelectMany(this IObservable source, Func> taskSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (taskSelector == null)
{
throw new ArgumentNullException(nameof(taskSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, taskSelector, resultSelector);
}
///
/// Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner sequences and the elements in the merged result sequence.
/// An observable sequence of notifications to project.
/// A transform function to apply to each element.
/// A transform function to apply when an error occurs in the source sequence.
/// A transform function to apply when the end of the source sequence is reached.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
/// or or or is null.
public static IObservable SelectMany(this IObservable source, Func> onNext, Func> onError, Func> onCompleted)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (onNext == null)
{
throw new ArgumentNullException(nameof(onNext));
}
if (onError == null)
{
throw new ArgumentNullException(nameof(onError));
}
if (onCompleted == null)
{
throw new ArgumentNullException(nameof(onCompleted));
}
return s_impl.SelectMany(source, onNext, onError, onCompleted);
}
///
/// Projects each notification of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner sequences and the elements in the merged result sequence.
/// An observable sequence of notifications to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// A transform function to apply when an error occurs in the source sequence.
/// A transform function to apply when the end of the source sequence is reached.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
/// or or or is null.
public static IObservable SelectMany(this IObservable source, Func> onNext, Func> onError, Func> onCompleted)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (onNext == null)
{
throw new ArgumentNullException(nameof(onNext));
}
if (onError == null)
{
throw new ArgumentNullException(nameof(onError));
}
if (onCompleted == null)
{
throw new ArgumentNullException(nameof(onCompleted));
}
return s_impl.SelectMany(source, onNext, onError, onCompleted);
}
///
/// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
/// or is null.
/// The projected sequences are enumerated synchronously 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 conversion.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// Projects each element of an observable sequence to an enumerable sequence by incorporating the element's index and concatenates the resulting enumerable sequences into one observable sequence.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
/// or is null.
/// The projected sequences are enumerated synchronously 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 conversion.
public static IObservable SelectMany(this IObservable source, Func> selector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}
return s_impl.SelectMany(source, selector);
}
///
/// 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.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected intermediate enumerable sequences.
/// 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.
/// An observable sequence of elements to project.
/// A transform function to apply to each element.
/// A transform function to apply to each element of the intermediate sequence.
/// 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.
/// or or is null.
/// The projected sequences are enumerated synchronously 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 conversion.
public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (collectionSelector == null)
{
throw new ArgumentNullException(nameof(collectionSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, collectionSelector, resultSelector);
}
///
/// Projects each element of an observable sequence to an enumerable sequence by incorporating the element's index, 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.
///
/// The type of the elements in the source sequence.
/// The type of the elements in the projected intermediate enumerable sequences.
/// 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.
/// An observable sequence of elements to project.
/// A transform function to apply to each element; the second parameter of the function represents the index of the source element.
/// A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element and the fourth parameter represents the index of the intermediate element.
/// 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.
/// or or is null.
/// The projected sequences are enumerated synchronously 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 conversion.
public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (collectionSelector == null)
{
throw new ArgumentNullException(nameof(collectionSelector));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.SelectMany(source, collectionSelector, resultSelector);
}
#endregion
#region + Skip +
///
/// Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
///
/// The type of the elements in the source sequence.
/// The sequence to take elements from.
/// The number of elements to skip before returning the remaining elements.
/// An observable sequence that contains the elements that occur after the specified index in the input sequence.
/// is null.
/// is less than zero.
public static IObservable Skip(this IObservable source, int count)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count));
}
return s_impl.Skip(source, count);
}
#endregion
#region + SkipWhile +
///
/// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
///
/// The type of the elements in the source sequence.
/// An observable sequence to return elements from.
/// A function to test each element for a condition.
/// An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
/// or is null.
public static IObservable SkipWhile(this IObservable source, Func predicate)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (predicate == null)
{
throw new ArgumentNullException(nameof(predicate));
}
return s_impl.SkipWhile(source, predicate);
}
///
/// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
/// The element's index is used in the logic of the predicate function.
///
/// The type of the elements in the source sequence.
/// An observable sequence to return elements from.
/// A function to test each element for a condition; the second parameter of the function represents the index of the source element.
/// An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
/// or is null.
public static IObservable SkipWhile(this IObservable source, Func predicate)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (predicate == null)
{
throw new ArgumentNullException(nameof(predicate));
}
return s_impl.SkipWhile(source, predicate);
}
#endregion
#region + Take +
///
/// Returns a specified number of contiguous elements from the start of an observable sequence.
///
/// The type of the elements in the source sequence.
/// The sequence to take elements from.
/// The number of elements to return.
/// An observable sequence that contains the specified number of elements from the start of the input sequence.
/// is null.
/// is less than zero.
public static IObservable Take(this IObservable source, int count)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count));
}
return s_impl.Take(source, count);
}
///
/// Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of Take(0).
///
/// The type of the elements in the source sequence.
/// The sequence to take elements from.
/// The number of elements to return.
/// Scheduler used to produce an OnCompleted message in case count is set to 0.
/// An observable sequence that contains the specified number of elements from the start of the input sequence.
/// or is null.
/// is less than zero.
public static IObservable Take(this IObservable source, int count, IScheduler scheduler)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count));
}
if (scheduler == null)
{
throw new ArgumentNullException(nameof(scheduler));
}
return s_impl.Take(source, count, scheduler);
}
#endregion
#region + TakeWhile +
///
/// Returns elements from an observable sequence as long as a specified condition is true.
///
/// The type of the elements in the source sequence.
/// A sequence to return elements from.
/// A function to test each element for a condition.
/// An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
///