ISubject<TSource, TResult> 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 In TSource, Out TResult) _
Inherits IObserver(Of TSource), IObservable(Of TResult)
'Usage
Dim instance As ISubject(Of In TSource, Out TResult)
public interface ISubject<in TSource, out TResult> : IObserver<TSource>,
IObservable<TResult>
generic<typename TSource, typename TResult>
public interface class ISubject : IObserver<TSource>,
IObservable<TResult>
type ISubject<'TSource, 'TResult> =
interface
interface IObserver<'TSource>
interface IObservable<'TResult>
end
JScript does not support generic types and methods.
Type Parameters
inTSource
The type of source.This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see .
outTResult
The type of result.This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see .
The ISubject<TSource, TResult> type exposes the following members.
Methods
Name | Description | |
---|---|---|
OnCompleted | (Inherited from IObserver<TSource>.) | |
OnError | (Inherited from IObserver<TSource>.) | |
OnNext | (Inherited from IObserver<TSource>.) | |
Subscribe | (Inherited from IObservable<TResult>.) |
Top
Extension Methods
Name | Description | |
---|---|---|
Aggregate<TResult>(Func<TResult, TResult, TResult>) | Overloaded. Applies an accumulator function over an observable sequence. (Defined by Observable.) | |
Aggregate<TResult, TAccumulate>(TAccumulate, Func<TAccumulate, TResult, TAccumulate>) | Overloaded. Applies an accumulator function over an observable sequence with the specified seed value. (Defined by Observable.) | |
All<TResult> | Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.) | |
Amb<TResult> | Propagates the observable sequence that reacts first with the specified first and second sequence. (Defined by Observable.) | |
And<TResult, TRight> | Matches when both observable sequences have an available value. (Defined by Observable.) | |
Any<TResult>() | Overloaded. Determines whether an observable sequence contains any elements. (Defined by Observable.) | |
Any<TResult>(Func<TResult, Boolean>) | Overloaded. Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.) | |
AsObservable<TResult> | Hides the identity of an observable sequence. (Defined by Observable.) | |
AsObserver<TSource> | Hides the identity of an observer. (Defined by Observer.) | |
AsQbservable<TResult> | Converts an observable sequence into a queryable observable sequence. (Defined by Qbservable.) | |
AssertEqual<TResult> | (Defined by Extensions.) | |
Buffer<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult, TBufferClosing>(Func<IObservable<TBufferClosing>>) | Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers. (Defined by Observable.) | |
Buffer<TResult, 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<TResult>(IObservable<TResult>) | Overloaded. Continues an observable sequence that is terminated by an exception with the next observable sequence. (Defined by Observable.) | |
Catch<TResult, TException>(Func<TException, IObservable<TResult>>) | 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<TResult, 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<TResult> | Concatenates two observable sequences. (Defined by Observable.) | |
Contains<TResult>(TResult) | Overloaded. Determines whether an observable sequence contains a specified element by using the default equality comparer. (Defined by Observable.) | |
Contains<TResult>(TResult, IEqualityComparer<TResult>) | Overloaded. Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer<T>. (Defined by Observable.) | |
Count<TResult> | Returns a Int32 that represents the total number of elements in an observable sequence. (Defined by Observable.) | |
DefaultIfEmpty<TResult>() | 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<TResult>(TResult) | 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<TResult>(TimeSpan) | Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.) | |
Delay<TResult>(DateTimeOffset) | Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.) | |
Delay<TResult>(TimeSpan, IScheduler) | Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.) | |
Delay<TResult>(DateTimeOffset, IScheduler) | Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.) | |
Distinct<TResult>() | Overloaded. Returns an observable sequence that contains only distinct elements with a specified source. (Defined by Observable.) | |
Distinct<TResult>(IEqualityComparer<TResult>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the comparer. (Defined by Observable.) | |
Distinct<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.) | |
Distinct<TResult, TKey>(Func<TResult, TKey>, IEqualityComparer<TKey>) | Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.) | |
DistinctUntilChanged<TResult>() | Overloaded. Returns an observable sequence that contains only distinct contiguous elements with a specified source. (Defined by Observable.) | |
DistinctUntilChanged<TResult>(IEqualityComparer<TResult>) | Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the comparer. (Defined by Observable.) | |
DistinctUntilChanged<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the keySelector. (Defined by Observable.) | |
DistinctUntilChanged<TResult, TKey>(Func<TResult, 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<TResult>(Action<TResult>) | Overloaded. Invokes an action for each element in the observable sequence. (Defined by Observable.) | |
Do<TResult>(IObserver<TResult>) | 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<TResult>(Action<TResult>, 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<TResult>(Action<TResult>, 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<TResult>(Action<TResult>, 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<TResult> | Returns the element at a specified index in a sequence. (Defined by Observable.) | |
ElementAtOrDefault<TResult> | 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<TResult> | Invokes a specified action after source observable sequence terminates normally or by an exception. (Defined by Observable.) | |
First<TResult>() | Overloaded. Returns the first element of an observable sequence with a specified source. (Defined by Observable.) | |
First<TResult>(Func<TResult, Boolean>) | Overloaded. Returns the first element of an observable sequence that matches the predicate. (Defined by Observable.) | |
FirstOrDefault<TResult>() | Overloaded. Returns the first element of an observable sequence, or a default value if no value is found. (Defined by Observable.) | |
FirstOrDefault<TResult>(Func<TResult, 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<TResult, R> | (Defined by MyExt.) | |
ForEach<TResult> | Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. (Defined by Observable.) | |
GetEnumerator<TResult> | Returns an enumerator that enumerates all values of the observable sequence. (Defined by Observable.) | |
GroupBy<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function. (Defined by Observable.) | |
GroupBy<TResult, TKey>(Func<TResult, TKey>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function and comparer. (Defined by Observable.) | |
GroupBy<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, TElement>) | Overloaded. Groups the elements of an observable sequence and selects the resulting elements by using a specified function. (Defined by Observable.) | |
GroupBy<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, 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<TResult, TKey, TDuration>(Func<TResult, TKey>, Func<IGroupedObservable<TKey, TResult>, IObservable<TDuration>>) | Overloaded. Groups the elements of an observable sequence according to a specified key selector function. (Defined by Observable.) | |
GroupByUntil<TResult, TKey, TDuration>(Func<TResult, TKey>, Func<IGroupedObservable<TKey, TResult>, 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<TResult, TKey, TElement, TDuration>(Func<TResult, TKey>, Func<TResult, 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<TResult, TKey, TElement, TDuration>(Func<TResult, TKey>, Func<TResult, 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<TResult, TRight, TLeftDuration, TRightDuration, TResult> | Correlates the elements of two sequences based on overlapping durations, and groups the results. (Defined by Observable.) | |
IgnoreElements<TResult> | Ignores all values in an observable sequence leaving only the termination messages. (Defined by Observable.) | |
Join<TResult, TRight, TLeftDuration, TRightDuration, TResult> | Correlates the elements of two sequences based on overlapping durations. (Defined by Observable.) | |
Last<TResult>() | Overloaded. Returns the last element of an observable sequence with a specified source. (Defined by Observable.) | |
Last<TResult>(Func<TResult, Boolean>) | Overloaded. Returns the last element of an observable sequence that matches the predicate. (Defined by Observable.) | |
LastOrDefault<TResult>() | Overloaded. Returns last element in the observable sequence, or a default value if no value is found. (Defined by Observable.) | |
LastOrDefault<TResult>(Func<TResult, 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<TResult> | Samples the most recent value in an observable sequence. (Defined by Observable.) | |
LongCount<TResult> | Returns a Int64 that represents the total number of elements in an observable sequence. (Defined by Observable.) | |
Materialize<TResult> | Materializes the implicit notifications of an observable sequence as explicit notification values. (Defined by Observable.) | |
Max<TResult>() | Overloaded. Returns the maximum element in an observable sequence. (Defined by Observable.) | |
Max<TResult>(IComparer<TResult>) | Overloaded. Returns the maximum value in an observable sequence according to the specified comparer. (Defined by Observable.) | |
MaxBy<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.) | |
MaxBy<TResult, TKey>(Func<TResult, TKey>, IComparer<TKey>) | Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.) | |
Merge<TResult>(IObservable<TResult>) | Overloaded. Merges an observable sequence of observable sequences into an observable sequence. (Defined by Observable.) | |
Merge<TResult>(IObservable<TResult>, IScheduler) | Overloaded. Merges two observable sequences into a single observable sequence. (Defined by Observable.) | |
Min<TResult>() | Overloaded. Returns the minimum element in an observable sequence. (Defined by Observable.) | |
Min<TResult>(IComparer<TResult>) | Overloaded. Returns the minimum value in an observable sequence according to the specified comparer. (Defined by Observable.) | |
MinBy<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Returns the elements in an observable sequence with the minimum key value. (Defined by Observable.) | |
MinBy<TResult, TKey>(Func<TResult, 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<TResult> | Samples the most recent value in an observable sequence. (Defined by Observable.) | |
Multicast<TResult, TResult>(ISubject<TResult, 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<TResult, TIntermediate, TResult>(Func<ISubject<TResult, 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<TResult> | Samples the next value (blocking without buffering) from in an observable sequence. (Defined by Observable.) | |
ObserveOn<TResult>(SynchronizationContext) | Overloaded. Asynchronously notify observers on the specified synchronization context. (Defined by Observable.) | |
ObserveOn<TResult>(Control) | Overloaded. (Defined by ControlObservable.) | |
ObserveOn<TResult>(Dispatcher) | Overloaded. (Defined by DispatcherObservable.) | |
ObserveOn<TResult>(DispatcherScheduler) | Overloaded. (Defined by DispatcherObservable.) | |
ObserveOn<TResult>(IScheduler) | Overloaded. Asynchronously notify observers on the specified scheduler. (Defined by Observable.) | |
ObserveOnDispatcher<TResult> | (Defined by DispatcherObservable.) | |
OnErrorResumeNext<TResult> | Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. (Defined by Observable.) | |
Publish<TResult>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence. (Defined by Observable.) | |
Publish<TResult>(TResult) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. (Defined by Observable.) | |
Publish<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, IObservable<TResult>>, TResult) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. (Defined by Observable.) | |
PublishLast<TResult>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. (Defined by Observable.) | |
PublishLast<TResult, TResult>(Func<IObservable<TResult>, 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<TResult>() | Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.) | |
Repeat<TResult>(Int32) | Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.) | |
Replay<TResult>() | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.) | |
Replay<TResult>(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<TResult>(Int32) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) | |
Replay<TResult>(IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.) | |
Replay<TResult>(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<TResult>(Int32, IScheduler) | Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.) | |
Replay<TResult>(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<TResult>(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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult, TResult>(Func<IObservable<TResult>, 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<TResult>() | Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.) | |
Retry<TResult>(Int32) | Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.) | |
Sample<TResult>(TimeSpan) | Overloaded. Samples the observable sequence at each interval. (Defined by Observable.) | |
Sample<TResult>(TimeSpan, IScheduler) | Overloaded. Samples the observable sequence at each interval with the specified source, interval and scheduler. (Defined by Observable.) | |
Sample<TResult, TSample>(IObservable<TSample>) | Overloaded. Samples the observable sequence at sampling ticks with the specified source and sampler. (Defined by Observable.) | |
Scan<TResult>(Func<TResult, TResult, TResult>) | Overloaded. Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator. (Defined by Observable.) | |
Scan<TResult, TAccumulate>(TAccumulate, Func<TAccumulate, TResult, 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<TResult, TResult>(Func<TResult, TResult>) | Overloaded. Projects each element of an observable sequence into a new form with the specified source and selector. (Defined by Observable.) | |
Select<TResult, TResult>(Func<TResult, 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<TResult, 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<TResult, TResult>(Func<TResult, 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<TResult, TResult>(Func<TResult, 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<TResult, TResult>(Func<TResult, 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<TResult, TCollection, TResult>(Func<TResult, IEnumerable<TCollection>>, Func<TResult, 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<TResult, TCollection, TResult>(Func<TResult, IObservable<TCollection>>, Func<TResult, 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<TResult>(IObservable<TResult>) | Overloaded. Determines whether two sequences are equal by comparing the elements pairwise. (Defined by Observable.) | |
SequenceEqual<TResult>(IObservable<TResult>, IEqualityComparer<TResult>) | Overloaded. Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer. (Defined by Observable.) | |
Single<TResult>() | 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<TResult>(Func<TResult, 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<TResult>() | Overloaded. Returns the only element of an observable sequence, or a default value if the observable sequence is empty. (Defined by Observable.) | |
SingleOrDefault<TResult>(Func<TResult, 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<TResult> | Bypasses a specified number of values in an observable sequence and then returns the remaining values. (Defined by Observable.) | |
SkipLast<TResult> | Bypasses a specified number of elements at the end of an observable sequence. (Defined by Observable.) | |
SkipUntil<TResult, TOther> | Returns the values from the source observable sequence only after the other observable sequence produces a value. (Defined by Observable.) | |
SkipWhile<TResult>(Func<TResult, 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<TResult>(Func<TResult, 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<TResult>TResult[]) | Overloaded. Prepends a sequence of values to an observable sequence with the specified source and values. (Defined by Observable.) | |
StartWith<TResult>(IScheduler, TResult[]) | Overloaded. Prepends a sequence of values to an observable sequence with the specified source, scheduler and values. (Defined by Observable.) | |
Subscribe<TResult>() | Overloaded. Evaluates the observable sequence with a specified source. (Defined by ObservableExtensions.) | |
Subscribe<TResult>(Action<TResult>) | Overloaded. Subscribes an element handler to an observable sequence. (Defined by ObservableExtensions.) | |
Subscribe<TResult>(Action<TResult>, Action<Exception>) | Overloaded. Subscribes an element handler and an exception handler to an observable sequence. (Defined by ObservableExtensions.) | |
Subscribe<TResult>(Action<TResult>, Action) | Overloaded. Subscribes an element handler and a completion handler to an observable sequence. (Defined by ObservableExtensions.) | |
Subscribe<TResult>(Action<TResult>, Action<Exception>, Action) | Overloaded. Subscribes an element handler, an exception handler, and a completion handler to an observable sequence. (Defined by ObservableExtensions.) | |
SubscribeOn<TResult>(SynchronizationContext) | Overloaded. Asynchronously subscribes and unsubscribes observers on the specified synchronization context. (Defined by Observable.) | |
SubscribeOn<TResult>(Control) | Overloaded. (Defined by ControlObservable.) | |
SubscribeOn<TResult>(Dispatcher) | Overloaded. (Defined by DispatcherObservable.) | |
SubscribeOn<TResult>(DispatcherScheduler) | Overloaded. (Defined by DispatcherObservable.) | |
SubscribeOn<TResult>(IScheduler) | Overloaded. Asynchronously subscribes and unsubscribes observers on the specified scheduler. (Defined by Observable.) | |
SubscribeOnDispatcher<TResult> | (Defined by DispatcherObservable.) | |
Synchronize<TResult>() | Overloaded. Synchronizes the observable sequence. (Defined by Observable.) | |
Synchronize<TResult>(Object) | Overloaded. Synchronizes the observable sequence. (Defined by Observable.) | |
Take<TResult> | Returns a specified number of contiguous values from the start of an observable sequence. (Defined by Observable.) | |
TakeLast<TResult> | Returns a specified number of contiguous elements from the end of an observable sequence. (Defined by Observable.) | |
TakeUntil<TResult, TOther> | Returns the values from the source observable sequence until the other observable sequence produces a value. (Defined by Observable.) | |
TakeWhile<TResult>(Func<TResult, 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<TResult>(Func<TResult, 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<TResult, TResult> | Matches when the observable sequence has an available value and projects the value. (Defined by Observable.) | |
Throttle<TResult>(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<TResult>(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<TResult>() | Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source. (Defined by Observable.) | |
TimeInterval<TResult>(IScheduler) | Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source and scheduler. (Defined by Observable.) | |
Timeout<TResult>(TimeSpan) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(DateTimeOffset) | Overloaded. Returns either the observable sequence or a TimeoutException if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(TimeSpan, IObservable<TResult>) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(DateTimeOffset, IObservable<TResult>) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(TimeSpan, IScheduler) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(DateTimeOffset, IScheduler) | Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(TimeSpan, IObservable<TResult>, IScheduler) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) | |
Timeout<TResult>(DateTimeOffset, IObservable<TResult>, IScheduler) | Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.) | |
Timestamp<TResult>() | Overloaded. Records the timestamp for each value in an observable sequence with the specified source. (Defined by Observable.) | |
Timestamp<TResult>(IScheduler) | Overloaded. Records the timestamp for each value in an observable sequence with the specified source and scheduler. (Defined by Observable.) | |
ToArray<TResult> | Creates an array from an observable sequence. (Defined by Observable.) | |
ToDictionary<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function. (Defined by Observable.) | |
ToDictionary<TResult, TKey>(Func<TResult, 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<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, 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<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, 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<TResult> | Converts an observable sequence to an enumerable sequence. (Defined by Observable.) | |
ToEvent<TResult> | Exposes an observable sequence as an object with a .NET event with a specified source. (Defined by Observable.) | |
ToList<TResult> | Creates a list from an observable sequence. (Defined by Observable.) | |
ToLookup<TResult, TKey>(Func<TResult, TKey>) | Overloaded. Creates a lookup from an observable sequence according to a specified key selector function. (Defined by Observable.) | |
ToLookup<TResult, TKey>(Func<TResult, 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<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, 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<TResult, TKey, TElement>(Func<TResult, TKey>, Func<TResult, 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<TSource> | Creates a notification callback from an observer. (Defined by Observer.) | |
ToTask<TResult>() | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) | |
ToTask<TResult>(Object) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) | |
ToTask<TResult>(CancellationToken) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) | |
ToTask<TResult>(CancellationToken, Object) | Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.) | |
Where<TResult>(Func<TResult, Boolean>) | Overloaded. Filters the elements of an observable sequence based on a predicate. (Defined by Observable.) | |
Where<TResult>(Func<TResult, Int32, Boolean>) | Overloaded. Filters the elements of an observable sequence based on a predicate by incorporating the element's index. (Defined by Observable.) | |
Window<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult, TWindowClosing>(Func<IObservable<TWindowClosing>>) | Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows. (Defined by Observable.) | |
Window<TResult, 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<TResult, TSecond, TResult>(IObservable<TSecond>, Func<TResult, TSecond, TResult>) | Overloaded. Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion. (Defined by Observable.) | |
Zip<TResult, TSecond, TResult>(IEnumerable<TSecond>, Func<TResult, 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
This subject interface provides the flexibility to a subject to observe an observable sequence of one type while publishing an observable sequence of another type.
Examples
This example demonstrates implementing an ISubject<TSource, TResult> which observes an observable sequence of one type while publishing an observable sequence of another type. The AsciiConverterSubject in this example demonstrates the implementation by observing sequences of type char and publishing an observable sequence of int. The published observable sequence of int is the ASCII code for each char value it observes.
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Threading;
namespace Example
{
class Program
{
static void Main()
{
//****************************************************************************************//
//*** Create an observable sequence of char from console input until enter is pressed. ***//
//****************************************************************************************//
IObservable<char> keySequence = Observable.Create<char>(observer =>
{
bool bContinue = true;
while (bContinue)
{
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
if (keyInfo.Key != ConsoleKey.Enter)
{
observer.OnNext(keyInfo.KeyChar);
}
else
{
observer.OnCompleted();
bContinue = false;
}
}
return (() => { });
});
//****************************************************************************************//
//*** Create an AsciiConverterSubject which takes a source type of char and returns an ***//
//*** observable sequence of int which is the ASCII code for source items of char. ***//
//****************************************************************************************//
AsciiConverterSubject myConverterSubject = new AsciiConverterSubject();
//****************************************************************************************//
//*** Subscribe to the keySequence on the .NET threadpool so the main thread can ***//
//*** create subscriptions to the AsciiConverterSubject ***//
//****************************************************************************************//
IDisposable subscription = keySequence.SubscribeOn(Scheduler.ThreadPool).Subscribe(myConverterSubject);
Console.WriteLine("\nEnter a sequence of keys to have the AsciiConverterSubject\nconvert the keys to their ASCII code values.\n");
Console.WriteLine("Press ENTER to terminate the observable sequence...\n");
//****************************************************************************************//
//*** Subscribe to the AsciiConverterSubject and write the ASCII code values to the ***//
//*** console window. ***//
//*** ***//
//*** The main thread will wait on the completion of the keySequence. It completes ***//
//*** when ENTER is pressed. ***//
//****************************************************************************************//
EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
myConverterSubject.Subscribe(c => Console.WriteLine("Ascii Char code {0} entered.",c), () => waitHandle.Set());
waitHandle.WaitOne();
//***************************************//
//*** Explicitly releasing resources. ***//
//***************************************//
subscription.Dispose();
myConverterSubject.Dispose();
}
}
//***********************************************************************************************//
//*** ***//
//*** The AsciiConverterSubject demonstrates an implementation of ISubject<TSource, TResult>. ***//
//*** It is used to subscribe to an observable sequence of char. It publishes an observable ***//
//*** sequence of int which should be the ASCII code for each char value it observes. ***//
//*** ***//
//***********************************************************************************************//
class AsciiConverterSubject : ISubject<char, int>, IDisposable
{
private List<IObserver<int>> observerList;
private bool isDisposed;
private bool isStopped;
object gate = new object();
Exception exception;
public AsciiConverterSubject()
{
observerList = new List<IObserver<int>>();
}
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)
{
foreach (IObserver<int> 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)
{
exception = error;
foreach (IObserver<int> observer in observerList)
{
observer.OnError(error);
}
observerList.Clear();
isStopped = true;
}
}
}
public void OnNext(char 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)
{
foreach (IObserver<int> observer in observerList)
{
observer.OnNext(Convert.ToInt32(value));
}
}
}
}
public IDisposable Subscribe(IObserver<int> 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)
{
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<int> observer)
{
//****************************************************************************************//
//*** Make sure Unsubscribe occurs in sync with the other operations so we keep the ***//
//*** correct behavior. ***//
//****************************************************************************************//
lock (gate)
{
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)
{
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 AsciiConverterSubject subject;
private IObserver<int> observer;
public Subscription(IObserver<int> obs, AsciiConverterSubject sub)
{
subject = sub;
observer = obs;
}
public void Dispose()
{
subject.Unsubscribe(observer);
}
}
}
}
The following output was generated by the example code.
Enter a sequence of keys to have the AsciiConverterSubject
convert the keys to their ASCII code values.
Press ENTER to terminate the observable sequence...
Ascii Char code 59 entered.
Ascii Char code 108 entered.
Ascii Char code 115 entered.
Ascii Char code 100 entered.
Ascii Char code 107 entered.
Ascii Char code 102 entered.
Ascii Char code 59 entered.
Ascii Char code 108 entered.
Ascii Char code 115 entered.
Ascii Char code 100 entered.
Ascii Char code 107 entered.
Ascii Char code 102 entered.
Ascii Char code 59 entered.
Ascii Char code 108 entered.
Ascii Char code 115 entered.
Ascii Char code 107 entered.
Ascii Char code 100 entered.
Ascii Char code 59 entered.
Ascii Char code 102 entered.
Ascii Char code 108 entered.
Ascii Char code 115 entered.
Ascii Char code 107 entered.
Ascii Char code 100 entered.