Skip to content

,System.Int32)} ,System.Int32,System.Int32)} ,System.TimeSpan)} ,System.TimeSpan,System.Int32)} ,System.TimeSpan,System.Int32,System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan,System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan,System.TimeSpan)} ,System.TimeSpan,System.TimeSpan,System.Reactive.Concurrency.IScheduler)} ,System.IObservable{--1})} ,System.Linq.Expressions.Expression{System.Func{System.IObservable{--1}}})} ,System.IObservable{--1},System.Linq.Expressions.Expression{System.Func{--1,System.IObservable{--2}}})}

Qbservable.Window(IQbservable, int) method

Defined in

Type: Qbservable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count)
  • 2. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count, int skip)
  • 3. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)
  • 4. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)
  • 5. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
  • 6. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
  • 7. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
  • 8. public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
  • 9. public static IQbservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IQbservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
  • 10. public static IQbservable<IObservable<TSource>> Window<TSource, TWindowClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TWindowClosing>>> windowClosingSelector)
  • 11. public static IQbservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(this IQbservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Expression<Func<TWindowOpening, IObservable<TWindowClosing>>> windowClosingSelector)

1. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count)

Summary: Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on element count information.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
countintLength of each window.

Returns: IQbservable> -- An observable sequence of windows.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptioncount is less than or equal to zero.

2. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count, int skip)

Summary: Projects each element of an observable sequence into zero or more windows which are produced based on element count information.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
countintLength of each window.
skipintNumber of elements to skip between creation of consecutive windows.

Returns: IQbservable> -- An observable sequence of windows.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptioncount or skip is less than or equal to zero.

3. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)

Summary: Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanLength of each window.

Returns: IQbservable> -- The sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows as fast as it can. Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptiontimeSpan is less than TimeSpan.Zero.

4. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)

Summary: Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed. A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanMaximum time length of a window.
countintMaximum element count of a window.

Returns: IQbservable> -- An observable sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows as fast as it can. Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptiontimeSpan is less than TimeSpan.Zero. -or- count is less than or equal to zero.

5. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)

Summary: Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers. A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanMaximum time length of a window.
countintMaximum element count of a window.
scheduler[IScheduler](#Scheduler to run windowing timers on.

Returns: IQbservable> -- An observable sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows as fast as it can. Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.
System.ArgumentOutOfRangeExceptiontimeSpan is less than TimeSpan.Zero. -or- count is less than or equal to zero.

6. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)

Summary: Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information, using the specified scheduler to run timers.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanLength of each window.
scheduler[IScheduler](#Scheduler to run windowing timers on.

Returns: IQbservable> -- An observable sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows as fast as it can. Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.
System.ArgumentOutOfRangeExceptiontimeSpan is less than TimeSpan.Zero.

7. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)

Summary: Projects each element of an observable sequence into zero or more windows which are produced based on timing information.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanLength of each window.
timeShiftTimeSpanInterval between creation of consecutive windows.

Returns: IQbservable> -- An observable sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows with minimum duration length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window may not execute immediately, despite the TimeSpan.Zero due time.

Specifying a TimeSpan.Zero value for timeShift is not recommended but supported, causing the scheduler to create windows as fast as it can. However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler, where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptiontimeSpan or timeSpan is less than TimeSpan.Zero.

8. Overload

public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)

Summary: Projects each element of an observable sequence into zero or more windows which are produced based on timing information, using the specified scheduler to run timers.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
timeSpanTimeSpanLength of each window.
timeShiftTimeSpanInterval between creation of consecutive windows.
scheduler[IScheduler](#Scheduler to run windowing timers on.

Returns: IQbservable> -- An observable sequence of windows.

Remarks

Specifying a TimeSpan.Zero value for timeSpan is not recommended but supported, causing the scheduler to create windows with minimum duration length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the current window may not execute immediately, despite the TimeSpan.Zero due time.

Specifying a TimeSpan.Zero value for timeShift is not recommended but supported, causing the scheduler to create windows as fast as it can. However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler, where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.
System.ArgumentOutOfRangeExceptiontimeSpan or timeSpan is less than TimeSpan.Zero.

9. Overload

public static IQbservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IQbservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)

Summary: Projects each element of an observable sequence into consecutive non-overlapping windows.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.
TWindowBoundaryThe type of the elements in the sequences indicating window boundary events.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
windowBoundariesIObservableSequence of window boundary markers. The current window is closed and a new window is opened upon receiving a boundary marker.

Returns: IQbservable> -- An observable sequence of windows.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or windowBoundaries is null.

10. Overload

public static IQbservable<IObservable<TSource>> Window<TSource, TWindowClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TWindowClosing>>> windowClosingSelector)

Summary: Projects each element of an observable sequence into consecutive non-overlapping windows.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.
TWindowClosingThe type of the elements in the sequences indicating window closing events.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
windowClosingSelectorExpression>>A function invoked to define the boundaries of the produced windows. A new window is started when the previous one is closed.

Returns: IQbservable> -- An observable sequence of windows.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or windowClosingSelector is null.

11. Overload

public static IQbservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(this IQbservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Expression<Func<TWindowOpening, IObservable<TWindowClosing>>> windowClosingSelector)

Summary: Projects each element of an observable sequence into zero or more windows.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence, and in the windows in the result sequence.
TWindowOpeningThe type of the elements in the sequence indicating window opening events, also passed to the closing selector to obtain a sequence of window closing events.
TWindowClosingThe type of the elements in the sequences indicating window closing events.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to produce windows over.
windowOpeningsIObservableObservable sequence whose elements denote the creation of new windows.
windowClosingSelectorExpression>>A function invoked to define the closing of each produced window.

Returns: IQbservable> -- An observable sequence of windows.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or windowOpenings or windowClosingSelector is null.