Skip to content

Instantly share code, notes, and snippets.

@bradphelan
Created February 20, 2014 08:41
Show Gist options
  • Save bradphelan/9109315 to your computer and use it in GitHub Desktop.
Save bradphelan/9109315 to your computer and use it in GitHub Desktop.
Window
/// <summary>
/// Projects each element of an observable sequence into consecutive non-overlapping windows.
///
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam><typeparam name="TWindowBoundary">The type of the elements in the sequences indicating window boundary events.</typeparam><param name="source">Source sequence to produce windows over.</param><param name="windowBoundaries">Sequence of window boundary markers. The current window is closed and a new window is opened upon receiving a boundary marker.</param>
/// <returns>
/// An observable sequence of windows.
/// </returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="source"/> or <paramref name="windowBoundaries"/> is null.</exception>
public static IObservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IObservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
{
if (source == null)
throw new ArgumentNullException("source");
if (windowBoundaries == null)
throw new ArgumentNullException("windowBoundaries");
else
return Observable.s_impl.Window<TSource, TWindowBoundary>(source, windowBoundaries);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment