ISubject<T> Interface
Represents an object that is both an observable sequence as well as an observer.
Namespace: System.Reactive.Subjects
Assembly: System.Reactive (in System.Reactive.dll)
Syntax
'Declaration
Public Interface ISubject(Of T) _
Inherits ISubject(Of T, T), IObserver(Of T), _
IObservable(Of T)
'Usage
Dim instance As ISubject(Of T)
public interface ISubject<T> : ISubject<T, T>,
IObserver<T>, IObservable<T>
generic<typename T>
public interface class ISubject : ISubject<T, T>,
IObserver<T>, IObservable<T>
type ISubject<'T> =
interface
interface ISubject<'T, 'T>
interface IObserver<'T>
interface IObservable<'T>
end
JScript does not support generic types and methods.
Type Parameters
- T
The type of the subject.
The ISubject<T> type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() |
OnCompleted | (Inherited from IObserver<T>.) |
![]() |
OnError | (Inherited from IObserver<T>.) |
![]() |
OnNext | (Inherited from IObserver<T>.) |
![]() |
Subscribe | (Inherited from IObservable<T>.) |
Top
Extension Methods
Name | Description | |
---|---|---|
![]() |
Aggregate<T>(Func<T, T, T>) | Overloaded. Applies an accumulator function over an observable sequence. (Defined by Observable.) |
![]() |
Aggregate<T, TAccumulate>(TAccumulate, Func<TAccumulate, T, TAccumulate>) | Overloaded. Applies an accumulator function over an observable sequence with the specified seed value. (Defined by Observable.) |
![]() |
All<T> | Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.) |
![]() |
Amb<T> | Propagates the observable sequence that reacts first with the specified first and second sequence. (Defined by Observable.) |
![]() |
And<T, TRight> | Matches when both observable sequences have an available value. (Defined by Observable.) |
![]() |
Any<T>() | Overloaded. Determines whether an observable sequence contains any elements. (Defined by Observable.) |
![]() |
Any<T>(Func<T, Boolean>) | Overloaded. Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.) |
![]() |
AsObservable<T> | Hides the identity of an observable sequence. (Defined by Observable.) |
![]() |
AsObserver<T> | Hides the identity of an observer. (Defined by Observer.) |
![]() |
AsQbservable<T> | Converts an observable sequence into a queryable observable sequence. (Defined by Qbservable.) |
![]() |
AssertEqual<T> | (Defined by Extensions.) |
![]() |
Buffer<T>(Int32) | Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers which are produced based on element count information. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan) | Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information. (Defined by Observable.) |
![]() |
Buffer<T>(Int32, Int32) | Overloaded. Indicates each element of an observable sequence into zero or more buffers which are produced based on element count information. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan, IScheduler) | Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan, TimeSpan) | Overloaded. Indicates each element of an observable sequence into zero or more buffers which are produced based on timing information. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan, Int32) | Overloaded. Indicates each element of an observable sequence into a buffer that’s sent out when either it’s full or a given amount of time has elapsed. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan, TimeSpan, IScheduler) | Overloaded. Indicates each element of an observable sequence into zero or more buffers which are produced based on timing information. (Defined by Observable.) |
![]() |
Buffer<T>(TimeSpan, Int32, IScheduler) | Overloaded. Indicates each element of an observable sequence into a buffer that’s sent out when either it’s full or a given amount of time has elapsed. (Defined by Observable.) |
![]() |
Buffer<T, TBufferClosing>(Func<IObservable<TBufferClosing>>) | Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers. (Defined by Observable.) |
![]() |
Buffer<T, TBufferOpening, TBufferClosing>(IObservable<TBufferOpening>, Func<TBufferOpening, IObservable<TBufferClosing>>) | Overloaded. Indicates each element of a queryable observable sequence into consecutive non-overlapping buffers. (Defined by Observable.) |
![]() |
Catch<T>(IObservable<T>) | Overloaded. Continues an observable sequence that is terminated by an exception with the next observable sequence. (Defined by Observable.) |
![]() |
Catch<T, TException>(Func<TException, IObservable<T>>) | Overloaded. Continues an observable sequence that is terminated by an exception of the specified type with the observable sequence produced by the handler. (Defined by Observable.) |
![]() |
CombineLatest<T, TSecond, TResult> | Merges two observable sequences into one observable sequence by using the selector function whenever one of the observable sequences produces an element. (Defined by Observable.) |
![]() |
Concat<T> | Concatenates two observable sequences. (Defined by Observable.) |
![]() |
Contains<T>(T) | Overloaded. Determines whether an observable sequence contains a specified element by using the default equality comparer. (Defined by Observable.) |
![]() |
Contains<T>(T, IEqualityComparer<T>) | Overloaded. Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer<T>. (Defined by Observable.) |
![]() |
Count<T> | Returns a Int32 that represents the total number of elements in an observable sequence. (Defined by Observable.) |
![]() |
DefaultIfEmpty<T>() | Overloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty. (Defined by Observable.) |
![]() |
DefaultIfEmpty<T>(T) | Overloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty. (Defined by Observable.) |
![]() |
Delay<T>(TimeSpan) | Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.) |
![]() |
Delay<T>(DateTimeOffset) | Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.) |
![]() |
Delay<T>(TimeSpan, IScheduler) | Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.) |
![]() |
Delay<T>(DateTimeOffset, IScheduler) | Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.) |
![]() |
Distinct<T>() | Overloaded. Returns an observable sequence that contains only distinct elements with a specified source. (Defined by Observable.) |
![]() |
Distinct<T>(IEqualityComparer<T>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the comparer. (Defined by Observable.) |
![]() |
Distinct<T, TKey>(Func<T, TKey>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.) |
![]() |
Distinct<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.) |
![]() |
DistinctUntilChanged<T>() | Overloaded. Returns an observable sequence that contains only distinct contiguous elements with a specified source. (Defined by Observable.) |
![]() |
DistinctUntilChanged<T>(IEqualityComparer<T>) | Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the comparer. (Defined by Observable.) |
![]() |
DistinctUntilChanged<T, TKey>(Func<T, TKey>) | Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the keySelector. (Defined by Observable.) |
![]() |
DistinctUntilChanged<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>) | Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. (Defined by Observable.) |
![]() |
Do<T>(Action<T>) | Overloaded. Invokes an action for each element in the observable sequence. (Defined by Observable.) |
![]() |
Do<T>(IObserver<T>) | Overloaded. Invokes an action for each element in the observable sequence and invokes an action upon exceptional termination of the observable sequence. (Defined by Observable.) |
![]() |
Do<T>(Action<T>, Action) | Overloaded. Invokes an action for each element in the observable sequence and invokes an action upon graceful termination of the observable sequence. (Defined by Observable.) |
![]() |
Do<T>(Action<T>, Action<Exception>) | Overloaded. Invokes an action for each element in the observable sequence and invokes an action upon exceptional termination of the observable sequence. (Defined by Observable.) |
![]() |
Do<T>(Action<T>, Action<Exception>, Action) | Overloaded. Invokes an action for each element in the observable sequence, and invokes an action upon graceful or exceptional termination of the observable sequence. (Defined by Observable.) |
![]() |
ElementAt<T> | Returns the element at a specified index in a sequence. (Defined by Observable.) |
![]() |
ElementAtOrDefault<T> | Returns the element at a specified index in a sequence or a default value if the index is out of range. (Defined by Observable.) |
![]() |
Finally<T> | Invokes a specified action after source observable sequence terminates normally or by an exception. (Defined by Observable.) |
![]() |
First<T>() | Overloaded. Returns the first element of an observable sequence with a specified source. (Defined by Observable.) |
![]() |
First<T>(Func<T, Boolean>) | Overloaded. Returns the first element of an observable sequence that matches the predicate. (Defined by Observable.) |
![]() |
FirstOrDefault<T>() | Overloaded. Returns the first element of an observable sequence, or a default value if no value is found. (Defined by Observable.) |
![]() |
FirstOrDefault<T>(Func<T, Boolean>) | Overloaded. Returns the first element of an observable sequence that matches the predicate, or a default value if no value is found. (Defined by Observable.) |
![]() |
Foo<T, R> | (Defined by MyExt.) |
![]() |
ForEach<T> | Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. (Defined by Observable.) |
![]() |
GetEnumerator<T> | Returns an enumerator that enumerates all values of the observable sequence. (Defined by Observable.) |
![]() |
GroupBy<T, TKey>(Func<T, TKey>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function. (Defined by Observable.) |
![]() |
GroupBy<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function and comparer. (Defined by Observable.) |
![]() |
GroupBy<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>) | Overloaded. Groups the elements of an observable sequence and selects the resulting elements by using a specified function. (Defined by Observable.) |
![]() |
GroupBy<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>) | Overloaded. 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. (Defined by Observable.) |
![]() |
GroupByUntil<T, TKey, TDuration>(Func<T, TKey>, Func<IGroupedObservable<TKey, T>, IObservable<TDuration>>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function. (Defined by Observable.) |
![]() |
GroupByUntil<T, TKey, TDuration>(Func<T, TKey>, Func<IGroupedObservable<TKey, T>, IObservable<TDuration>>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function and comparer. (Defined by Observable.) |
![]() |
GroupByUntil<T, TKey, TElement, TDuration>(Func<T, TKey>, Func<T, TElement>, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function and selects the resulting elements by using a specified function. (Defined by Observable.) |
![]() |
GroupByUntil<T, TKey, TElement, TDuration>(Func<T, TKey>, Func<T, TElement>, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>, IEqualityComparer<TKey>) | Overloaded. 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. (Defined by Observable.) |
![]() |
GroupJoin<T, TRight, TLeftDuration, TRightDuration, TResult> | Correlates the elements of two sequences based on overlapping durations, and groups the results. (Defined by Observable.) |
![]() |
IgnoreElements<T> | Ignores all values in an observable sequence leaving only the termination messages. (Defined by Observable.) |
![]() |
Join<T, TRight, TLeftDuration, TRightDuration, TResult> | Correlates the elements of two sequences based on overlapping durations. (Defined by Observable.) |
![]() |
Last<T>() | Overloaded. Returns the last element of an observable sequence with a specified source. (Defined by Observable.) |
![]() |
Last<T>(Func<T, Boolean>) | Overloaded. Returns the last element of an observable sequence that matches the predicate. (Defined by Observable.) |
![]() |
LastOrDefault<T>() | Overloaded. Returns last element in the observable sequence, or a default value if no value is found. (Defined by Observable.) |
![]() |
LastOrDefault<T>(Func<T, Boolean>) | Overloaded. Returns the last element of an observable sequence that matches the predicate, or a default value if no value is found. (Defined by Observable.) |
![]() |
Latest<T> | Samples the most recent value in an observable sequence. (Defined by Observable.) |
![]() |
LongCount<T> | Returns a Int64 that represents the total number of elements in an observable sequence. (Defined by Observable.) |
![]() |
Materialize<T> | Materializes the implicit notifications of an observable sequence as explicit notification values. (Defined by Observable.) |
![]() |
Max<T>() | Overloaded. Returns the maximum element in an observable sequence. (Defined by Observable.) |
![]() |
Max<T>(IComparer<T>) | Overloaded. Returns the maximum value in an observable sequence according to the specified comparer. (Defined by Observable.) |
![]() |
MaxBy<T, TKey>(Func<T, TKey>) | Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.) |
![]() |
MaxBy<T, TKey>(Func<T, TKey>, IComparer<TKey>) | Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.) |
![]() |
Merge<T>(IObservable<T>) | Overloaded. Merges an observable sequence of observable sequences into an observable sequence. (Defined by Observable.) |
![]() |
Merge<T>(IObservable<T>, IScheduler) | Overloaded. Merges two observable sequences into a single observable sequence. (Defined by Observable.) |
![]() |
Min<T>() | Overloaded. Returns the minimum element in an observable sequence. (Defined by Observable.) |
![]() |
Min<T>(IComparer<T>) | Overloaded. Returns the minimum value in an observable sequence according to the specified comparer. (Defined by Observable.) |
![]() |
MinBy<T, TKey>(Func<T, TKey>) | Overloaded. Returns the elements in an observable sequence with the minimum key value. (Defined by Observable.) |
![]() |
MinBy<T, TKey>(Func<T, TKey>, IComparer<TKey>) | Overloaded. Returns the elements in an observable sequence with the minimum key value according to the specified comparer. (Defined by Observable.) |
![]() |
MostRecent<T> | Samples the most recent value in an observable sequence. (Defined by Observable.) |
![]() |
Multicast<T, TResult>(ISubject<T, TResult>) | Overloaded. Returns a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject. (Defined by Observable.) |
![]() |
Multicast<T, TIntermediate, TResult>(Func<ISubject<T, TIntermediate>>, Func<IObservable<TIntermediate>, IObservable<TResult>>) | Overloaded. Returns an observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. (Defined by Observable.) |
![]() |
Next<T> | Samples the next value (blocking without buffering) from in an observable sequence. (Defined by Observable.) |
![]() |
ObserveOn<T>(SynchronizationContext) | Overloaded. Asynchronously notify observers on the specified synchronization context. (Defined by Observable.) |
![]() |
ObserveOn<T>(Control) | Overloaded. (Defined by ControlObservable.) |
![]() |
ObserveOn<T>(Dispatcher) | Overloaded. (Defined by DispatcherObservable.) |
![]() |
ObserveOn<T>(DispatcherScheduler) | Overloaded. (Defined by DispatcherObservable.) |
![]() |
ObserveOn<T>(IScheduler) | Overloaded. Asynchronously notify observers on the specified scheduler. (Defined by Observable.) |
![]() |
ObserveOnDispatcher<T> | (Defined by DispatcherObservable.) |
![]() |
OnErrorResumeNext<T> | Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. (Defined by Observable.) |
![]() |
Publish<T>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence. (Defined by Observable.) |
![]() |
Publish<T>(T) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. (Defined by Observable.) |
![]() |
Publish<T, TResult>(Func<IObservable<T>, IObservable<TResult>>) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence. (Defined by Observable.) |
![]() |
Publish<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, T) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. (Defined by Observable.) |
![]() |
PublishLast<T>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. (Defined by Observable.) |
![]() |
PublishLast<T, TResult>(Func<IObservable<T>, IObservable<TResult>>) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. (Defined by Observable.) |
![]() |
Repeat<T>() | Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.) |
![]() |
Repeat<T>(Int32) | Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.) |
![]() |
Replay<T>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.) |
![]() |
Replay<T>(TimeSpan) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications within window. (Defined by Observable.) |
![]() |
Replay<T>(Int32) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) |
![]() |
Replay<T>(IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.) |
![]() |
Replay<T>(TimeSpan, IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications within window. (Defined by Observable.) |
![]() |
Replay<T>(Int32, IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) |
![]() |
Replay<T>(Int32, TimeSpan) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications within window. (Defined by Observable.) |
![]() |
Replay<T>(Int32, TimeSpan, IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications within window. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initial value. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, IScheduler) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, TimeSpan) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications within window. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, Int32) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, TimeSpan, IScheduler) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications within window. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, Int32, IScheduler) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, Int32, TimeSpan) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications within window. (Defined by Observable.) |
![]() |
Replay<T, TResult>(Func<IObservable<T>, IObservable<TResult>>, Int32, TimeSpan, IScheduler) | Overloaded. Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications within window. (Defined by Observable.) |
![]() |
Retry<T>() | Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.) |
![]() |
Retry<T>(Int32) | Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.) |
![]() |
Sample<T>(TimeSpan) | Overloaded. Samples the observable sequence at each interval. (Defined by Observable.) |
![]() |
Sample<T>(TimeSpan, IScheduler) | Overloaded. Samples the observable sequence at each interval with the specified source, interval and scheduler. (Defined by Observable.) |
![]() |
Sample<T, TSample>(IObservable<TSample>) | Overloaded. Samples the observable sequence at sampling ticks with the specified source and sampler. (Defined by Observable.) |
![]() |
Scan<T>(Func<T, T, T>) | Overloaded. Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator. (Defined by Observable.) |
![]() |
Scan<T, TAccumulate>(TAccumulate, Func<TAccumulate, T, TAccumulate>) | Overloaded. Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source, seed and accumulator. (Defined by Observable.) |
![]() |
Select<T, TResult>(Func<T, TResult>) | Overloaded. Projects each element of an observable sequence into a new form with the specified source and selector. (Defined by Observable.) |
![]() |
Select<T, TResult>(Func<T, Int32, TResult>) | Overloaded. Projects each element of an observable sequence into a new form by incorporating the element’s index with the specified source and selector. (Defined by Observable.) |
![]() |
SelectMany<T, TOther>(IObservable<TOther>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SelectMany<T, TResult>(Func<T, IObservable<TResult>>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SelectMany<T, TResult>(Func<T, IEnumerable<TResult>>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SelectMany<T, TResult>(Func<T, IObservable<TResult>>, Func<Exception, IObservable<TResult>>, Func<IObservable<TResult>>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SelectMany<T, TCollection, TResult>(Func<T, IEnumerable<TCollection>>, Func<T, TCollection, TResult>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SelectMany<T, TCollection, TResult>(Func<T, IObservable<TCollection>>, Func<T, TCollection, TResult>) | Overloaded. Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence. (Defined by Observable.) |
![]() |
SequenceEqual<T>(IObservable<T>) | Overloaded. Determines whether two sequences are equal by comparing the elements pairwise. (Defined by Observable.) |
![]() |
SequenceEqual<T>(IObservable<T>, IEqualityComparer<T>) | Overloaded. Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer. (Defined by Observable.) |
![]() |
Single<T>() | Overloaded. Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence. (Defined by Observable.) |
![]() |
Single<T>(Func<T, Boolean>) | Overloaded. Returns the only element of an observable sequence that matches the predicate and throws an exception if there is not exactly one element in the observable sequence. (Defined by Observable.) |
![]() |
SingleOrDefault<T>() | Overloaded. Returns the only element of an observable sequence, or a default value if the observable sequence is empty. (Defined by Observable.) |
![]() |
SingleOrDefault<T>(Func<T, Boolean>) | Overloaded. Returns the only element of an observable sequence that matches the predicate, or a default value if no value is found. (Defined by Observable.) |
![]() |
Skip<T> | Bypasses a specified number of values in an observable sequence and then returns the remaining values. (Defined by Observable.) |
![]() |
SkipLast<T> | Bypasses a specified number of elements at the end of an observable sequence. (Defined by Observable.) |
![]() |
SkipUntil<T, TOther> | Returns the values from the source observable sequence only after the other observable sequence produces a value. (Defined by Observable.) |
![]() |
SkipWhile<T>(Func<T, Boolean>) | Overloaded. Bypasses values in an observable sequence as long as a specified condition is true and then returns the remaining values. (Defined by Observable.) |
![]() |
SkipWhile<T>(Func<T, Int32, Boolean>) | Overloaded. Bypasses values in an observable sequence as long as a specified condition is true and then returns the remaining values. (Defined by Observable.) |
![]() |
StartWith<T>T[]) | Overloaded. Prepends a sequence of values to an observable sequence with the specified source and values. (Defined by Observable.) |
![]() |
StartWith<T>(IScheduler, T[]) | Overloaded. Prepends a sequence of values to an observable sequence with the specified source, scheduler and values. (Defined by Observable.) |
![]() |
Subscribe<T>() | Overloaded. Evaluates the observable sequence with a specified source. (Defined by ObservableExtensions.) |
![]() |
Subscribe<T>(Action<T>) | Overloaded. Subscribes an element handler to an observable sequence. (Defined by ObservableExtensions.) |
![]() |
Subscribe<T>(Action<T>, Action<Exception>) | Overloaded. Subscribes an element handler and an exception handler to an observable sequence. (Defined by ObservableExtensions.) |
![]() |
Subscribe<T>(Action<T>, Action) | Overloaded. Subscribes an element handler and a completion handler to an observable sequence. (Defined by ObservableExtensions.) |
![]() |
Subscribe<T>(Action<T>, Action<Exception>, Action) | Overloaded. Subscribes an element handler, an exception handler, and a completion handler to an observable sequence. (Defined by ObservableExtensions.) |
![]() |
SubscribeOn<T>(SynchronizationContext) | Overloaded. Asynchronously subscribes and unsubscribes observers on the specified synchronization context. (Defined by Observable.) |
![]() |
SubscribeOn<T>(Control) | Overloaded. (Defined by ControlObservable.) |
![]() |
SubscribeOn<T>(Dispatcher) | Overloaded. (Defined by DispatcherObservable.) |
![]() |
SubscribeOn<T>(DispatcherScheduler) | Overloaded. (Defined by DispatcherObservable.) |
![]() |
SubscribeOn<T>(IScheduler) | Overloaded. Asynchronously subscribes and unsubscribes observers on the specified scheduler. (Defined by Observable.) |
![]() |
SubscribeOnDispatcher<T> | (Defined by DispatcherObservable.) |
![]() |
Synchronize<T>() | Overloaded. Synchronizes the observable sequence. (Defined by Observable.) |
![]() |
Synchronize<T>(Object) | Overloaded. Synchronizes the observable sequence. (Defined by Observable.) |
![]() |
Take<T> | Returns a specified number of contiguous values from the start of an observable sequence. (Defined by Observable.) |
![]() |
TakeLast<T> | Returns a specified number of contiguous elements from the end of an observable sequence. (Defined by Observable.) |
![]() |
TakeUntil<T, TOther> | Returns the values from the source observable sequence until the other observable sequence produces a value. (Defined by Observable.) |
![]() |
TakeWhile<T>(Func<T, Boolean>) | Overloaded. Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. (Defined by Observable.) |
![]() |
TakeWhile<T>(Func<T, Int32, Boolean>) | Overloaded. Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. (Defined by Observable.) |
![]() |
Then<T, TResult> | Matches when the observable sequence has an available value and projects the value. (Defined by Observable.) |
![]() |
Throttle<T>(TimeSpan) | Overloaded. Ignores the values from an observable sequence which are followed by another value before due time with the specified source and dueTime. (Defined by Observable.) |
![]() |
Throttle<T>(TimeSpan, IScheduler) | Overloaded. Ignores the values from an observable sequence which are followed by another value before due time with the specified source, dueTime and scheduler. (Defined by Observable.) |
![]() |
TimeInterval<T>() | Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source. (Defined by Observable.) |
![]() |
TimeInterval<T>(IScheduler) | Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source and scheduler. (Defined by Observable.) |
![]() |
Timeout<T>(TimeSpan) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(DateTimeOffset) | Overloaded. Returns either the observable sequence or a TimeoutException if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(TimeSpan, IObservable<T>) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(DateTimeOffset, IObservable<T>) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(TimeSpan, IScheduler) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(DateTimeOffset, IScheduler) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(TimeSpan, IObservable<T>, IScheduler) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) |
![]() |
Timeout<T>(DateTimeOffset, IObservable<T>, IScheduler) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) |
![]() |
Timestamp<T>() | Overloaded. Records the timestamp for each value in an observable sequence with the specified source. (Defined by Observable.) |
![]() |
Timestamp<T>(IScheduler) | Overloaded. Records the timestamp for each value in an observable sequence with the specified source and scheduler. (Defined by Observable.) |
![]() |
ToArray<T> | Creates an array from an observable sequence. (Defined by Observable.) |
![]() |
ToDictionary<T, TKey>(Func<T, TKey>) | Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function. (Defined by Observable.) |
![]() |
ToDictionary<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>) | Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function, and a comparer. (Defined by Observable.) |
![]() |
ToDictionary<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>) | Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function, and an element selector function. (Defined by Observable.) |
![]() |
ToDictionary<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>) | Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function, a comparer, and an element selector function. (Defined by Observable.) |
![]() |
ToEnumerable<T> | Converts an observable sequence to an enumerable sequence. (Defined by Observable.) |
![]() |
ToEvent<T> | Exposes an observable sequence as an object with a .NET event with a specified source. (Defined by Observable.) |
![]() |
ToList<T> | Creates a list from an observable sequence. (Defined by Observable.) |
![]() |
ToLookup<T, TKey>(Func<T, TKey>) | Overloaded. Creates a lookup from an observable sequence according to a specified key selector function. (Defined by Observable.) |
![]() |
ToLookup<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>) | Overloaded. Creates a lookup from an observable sequence according to a specified key selector function, and a comparer. (Defined by Observable.) |
![]() |
ToLookup<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>) | Overloaded. Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function. (Defined by Observable.) |
![]() |
ToLookup<T, TKey, TElement>(Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>) | Overloaded. Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function. (Defined by Observable.) |
![]() |
ToNotifier<T> | Creates a notification callback from an observer. (Defined by Observer.) |
![]() |
ToTask<T>() | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) |
![]() |
ToTask<T>(Object) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) |
![]() |
ToTask<T>(CancellationToken) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) |
![]() |
ToTask<T>(CancellationToken, Object) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) |
![]() |
Where<T>(Func<T, Boolean>) | Overloaded. Filters the elements of an observable sequence based on a predicate. (Defined by Observable.) |
![]() |
Where<T>(Func<T, Int32, Boolean>) | Overloaded. Filters the elements of an observable sequence based on a predicate by incorporating the element's index. (Defined by Observable.) |
![]() |
Window<T>(Int32) | Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on element count information. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan) | Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information. (Defined by Observable.) |
![]() |
Window<T>(Int32, Int32) | Overloaded. Projects each element of an observable sequence into zero or more windows which are produced based on element count information. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan, IScheduler) | Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan, TimeSpan) | Overloaded. Projects each element of an observable sequence into zero or more windows which are produced based on timing information. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan, Int32) | Overloaded. 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. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan, TimeSpan, IScheduler) | Overloaded. Projects each element of an observable sequence into zero or more windows which are produced based on timing information. (Defined by Observable.) |
![]() |
Window<T>(TimeSpan, Int32, IScheduler) | Overloaded. 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. (Defined by Observable.) |
![]() |
Window<T, TWindowClosing>(Func<IObservable<TWindowClosing>>) | Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows. (Defined by Observable.) |
![]() |
Window<T, TWindowOpening, TWindowClosing>(IObservable<TWindowOpening>, Func<TWindowOpening, IObservable<TWindowClosing>>) | Overloaded. Projects each element of an observable sequence into zero or more windows. (Defined by Observable.) |
![]() |
Zip<T, TSecond, TResult>(IObservable<TSecond>, Func<T, TSecond, TResult>) | Overloaded. Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion. (Defined by Observable.) |
![]() |
Zip<T, TSecond, TResult>(IEnumerable<TSecond>, Func<T, TSecond, TResult>) | Overloaded. Merges an observable sequence and an enumerable sequence into one observable sequence by using the selector function. (Defined by Observable.) |
Top
Remarks
Implementing the ISubject interface allows you to create your own subject with custom behaviors.
Examples
The following example code implements a example subject which just echos method execution out to the console window.
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
namespace Example
{
class Program
{
static void Main()
{
//************************************************************************************//
//*** The ConsoleEchoSubject will just echo it's method calls out to the console ***//
//*** window. ***//
//*** ***//
//*** Create an instance of the ConsoleEchoSubject and subscribe to a sequence of ***//
//*** the first 5 integers returned by the Interval operator. ***//
//*** ***//
//************************************************************************************//
ConsoleEchoSubject<long> mySubject = new ConsoleEchoSubject<long>();
var obs = Observable.Interval(TimeSpan.FromSeconds(1), Scheduler.ThreadPool).Take(5);
Console.WriteLine("Subscribing ConsoleEchoSubject to observable sequence.\n");
obs.Subscribe(mySubject);
//************************************************************************************//
//*** Subscribe to the subject's observable interface. Each value will be written ***//
//*** to the console window. ***//
//************************************************************************************//
IDisposable subscription = mySubject.Subscribe(x => Console.WriteLine(x), () =>
{
Console.WriteLine("\nSequence Completed.\n");
Console.WriteLine("Press ENTER to exit...");
});
Console.ReadLine();
//***************************************//
//*** Explicitly releasing resources. ***//
//***************************************//
subscription.Dispose();
mySubject.Dispose();
}
}
//************************************************************************************//
//*** ***//
//*** The ConsoleEchoSubject will just echo it's method calls out to the console ***//
//*** window. ***//
//*** ***//
//************************************************************************************//
class ConsoleEchoSubject<T> : ISubject<T>, IDisposable
{
private List<IObserver<T>> observerList;
private bool isDisposed;
private bool isStopped;
object gate = new object();
Exception exception;
public ConsoleEchoSubject()
{
observerList = new List<IObserver<T>>();
}
public void OnCompleted()
{
//****************************************************************************************//
//*** Make sure the OnCompleted operation is not preempted by another operation ***//
//*** which would break the expected behavior. For example, don't allow an error from ***//
//*** OnError preempt OnCompleted from anotther thread. Then OnCompleted would follow ***//
//*** an error. That would be an incorrect behavior. ***//
//****************************************************************************************//
lock (gate)
{
CheckDisposed();
if (!isStopped)
{
Console.WriteLine("\nConsoleEchoSubject : OnCompleted()");
foreach (IObserver<T> observer in observerList)
{
observer.OnCompleted();
}
observerList.Clear();
isStopped = true;
}
}
}
public void OnError(Exception error)
{
if (error == null)
throw new ArgumentException("Exception error should not be null.");
//****************************************************************************************//
//*** Make sure the OnError operation is not preempted by another operation which ***//
//*** would break the expected behavior. For example, don't allow unsubscribe or an ***//
//*** OnCompleted operation to preempt OnError from another thread. This would result ***//
//*** in an error following completion. That would be an incorrect behavior. ***//
//****************************************************************************************//
lock (gate)
{
CheckDisposed();
if (!isStopped)
{
Console.WriteLine("\nConsoleEchoSubject : OnError({0})", error.Message);
exception = error;
foreach (IObserver<T> observer in observerList)
{
observer.OnError(error);
}
observerList.Clear();
isStopped = true;
}
}
}
public void OnNext(T value)
{
//****************************************************************************************//
//*** Make sure the OnNext operation is not preempted by another operation which ***//
//*** would break the expected behavior. For example, don't allow unsubscribe, errors ***//
//*** or an OnCompleted operation to preempt OnNext from another thread. This would ***//
//*** have the result of items in a sequence following completion, errors, or ***//
//*** unsubscribe. That would be an incorrect behavior. ***//
//****************************************************************************************//
lock (gate)
{
CheckDisposed();
if (!isStopped)
{
Console.WriteLine("\nConsoleEchoSubject : OnNext({0})", value.ToString());
foreach (IObserver<T> observer in observerList)
{
observer.OnNext(value);
}
}
}
}
public IDisposable Subscribe(IObserver<T> observer)
{
if (observer == null)
throw new ArgumentException("observer should not BehaviorSubject null.");
//****************************************************************************************//
//*** Make sure Subscribe occurs in sync with the other operations so we keep the ***//
//*** correct behavior depending on whether an error has occurred or the observable ***//
//*** sequence has completed. ***//
//****************************************************************************************//
lock (gate)
{
CheckDisposed();
if (!isStopped)
{
Console.WriteLine("\nConsoleEchoSubject : Creating new subscription.");
observerList.Add(observer);
return new Subscription(observer, this);
}
else if(exception != null)
{
observer.OnError(exception);
return Disposable.Empty;
}
else
{
observer.OnCompleted();
return Disposable.Empty;
}
}
}
private void Unsubscribe(IObserver<T> observer)
{
//****************************************************************************************//
//*** Make sure Unsubscribe occurs in sync with the other operations so we keep the ***//
//*** correct behavior. ***//
//****************************************************************************************//
lock (gate)
{
Console.WriteLine("\nConsoleEchoSubject : Unsubscribing subscription.");
observerList.Remove(observer);
}
}
public void Dispose()
{
//****************************************************************************************//
//*** Make sure Dispose occurs in sync with the other operations so we keep the ***//
//*** correct behavior. For example, Dispose shouldn't preempt the other operations ***//
//*** changing state variables after they have been checked. ***//
//****************************************************************************************//
lock (gate)
{
Console.WriteLine("\nConsoleEchoSubject : Disposing resources.");
observerList.Clear();
isStopped = true;
isDisposed = true;
}
}
private void CheckDisposed()
{
if (isDisposed)
throw new ObjectDisposedException("Subject has been disposed.");
}
//************************************************************************************//
//*** ***//
//*** The Subscription class wraps each observer that creates a subscription. This ***//
//*** is needed to expose an IDisposable interface through which a observer can ***//
//*** cancel the subscription. ***//
//*** ***//
//************************************************************************************//
class Subscription : IDisposable
{
private ConsoleEchoSubject<T> subject;
private IObserver<T> observer;
public Subscription(IObserver<T> obs, ConsoleEchoSubject<T> sub)
{
subject = sub;
observer = obs;
}
public void Dispose()
{
subject.Unsubscribe(observer);
}
}
}
}
The following output was generated by the example code.
Subscribing ConsoleEchoSubject to observable sequence.
ConsoleEchoSubject : Creating new subscription.
ConsoleEchoSubject : OnNext(0)
0
ConsoleEchoSubject : OnNext(1)
1
ConsoleEchoSubject : OnNext(2)
2
ConsoleEchoSubject : OnNext(3)
3
ConsoleEchoSubject : OnNext(4)
4
ConsoleEchoSubject : OnCompleted()
Sequence Completed.
Press ENTER to exit...
ConsoleEchoSubject : Unsubscribing subscription.
ConsoleEchoSubject : Disposing resources.
C:\