Export (0) Print
Expand All

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)

public interface ISubject<in TSource, out TResult> : IObserver<TSource>, 
	IObservable<TResult>

Type Parameters

in TSource

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 http://msdn.microsoft.com/en-us/library/dd799517.aspx.

out TResult

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 http://msdn.microsoft.com/en-us/library/dd799517.aspx.

The ISubject<TSource, TResult> type exposes the following members.

  NameDescription
Public methodOnCompleted (Inherited from IObserver<TSource>.)
Public methodOnError (Inherited from IObserver<TSource>.)
Public methodOnNext (Inherited from IObserver<TSource>.)
Public methodSubscribe (Inherited from IObservable<TResult>.)
Top

  NameDescription
Public Extension MethodAggregate<TResult>(Func<TResult, TResult, TResult>)Overloaded. Applies an accumulator function over an observable sequence. (Defined by Observable.)
Public Extension MethodAggregate<TResult, TAccumulate>(TAccumulate, Func<TAccumulate, TResult, TAccumulate>)Overloaded. Applies an accumulator function over an observable sequence with the specified seed value. (Defined by Observable.)
Public Extension MethodAll<TResult>Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.)
Public Extension MethodAmb<TResult>Propagates the observable sequence that reacts first with the specified first and second sequence. (Defined by Observable.)
Public Extension MethodAnd<TResult, TRight>Matches when both observable sequences have an available value. (Defined by Observable.)
Public Extension MethodAny<TResult>()Overloaded. Determines whether an observable sequence contains any elements. (Defined by Observable.)
Public Extension MethodAny<TResult>(Func<TResult, Boolean>)Overloaded. Determines whether all elements of an observable sequence satisfies a condition. (Defined by Observable.)
Public Extension MethodAsObservable<TResult>Hides the identity of an observable sequence. (Defined by Observable.)
Public Extension MethodAsObserver<TSource> Hides the identity of an observer. (Defined by Observer.)
Public Extension MethodAsQbservable<TResult>Converts an observable sequence into a queryable observable sequence. (Defined by Qbservable.)
Public Extension MethodAssertEqual<TResult> (Defined by Extensions.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<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.)
Public Extension MethodBuffer<TResult, TBufferClosing>(Func<IObservable<TBufferClosing>>)Overloaded. Indicates each element of an observable sequence into consecutive non-overlapping buffers. (Defined by Observable.)
Public Extension MethodBuffer<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.)
Public Extension MethodCatch<TResult>(IObservable<TResult>)Overloaded. Continues an observable sequence that is terminated by an exception with the next observable sequence. (Defined by Observable.)
Public Extension MethodCatch<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.)
Public Extension MethodCombineLatest<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.)
Public Extension MethodConcat<TResult>Concatenates two observable sequences. (Defined by Observable.)
Public Extension MethodContains<TResult>(TResult)Overloaded. Determines whether an observable sequence contains a specified element by using the default equality comparer. (Defined by Observable.)
Public Extension MethodContains<TResult>(TResult, IEqualityComparer<TResult>)Overloaded. Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer&lt;T&gt;. (Defined by Observable.)
Public Extension MethodCount<TResult>Returns a Int32 that represents the total number of elements in an observable sequence. (Defined by Observable.)
Public Extension MethodDefaultIfEmpty<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.)
Public Extension MethodDefaultIfEmpty<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.)
Public Extension MethodDelay<TResult>(TimeSpan)Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.)
Public Extension MethodDelay<TResult>(DateTimeOffset)Overloaded. Indicates the observable sequence by due time with the specified source and dueTime. (Defined by Observable.)
Public Extension MethodDelay<TResult>(TimeSpan, IScheduler)Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.)
Public Extension MethodDelay<TResult>(DateTimeOffset, IScheduler)Overloaded. Indicates the observable sequence by due time with the specified source, dueTime and scheduler. (Defined by Observable.)
Public Extension MethodDistinct<TResult>()Overloaded. Returns an observable sequence that contains only distinct elements with a specified source. (Defined by Observable.)
Public Extension MethodDistinct<TResult>(IEqualityComparer<TResult>)Overloaded. Returns an observable sequence that contains only distinct elements according to the comparer. (Defined by Observable.)
Public Extension MethodDistinct<TResult, TKey>(Func<TResult, TKey>)Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.)
Public Extension MethodDistinct<TResult, TKey>(Func<TResult, TKey>, IEqualityComparer<TKey>)Overloaded. Returns an observable sequence that contains only distinct elements according to the keySelector. (Defined by Observable.)
Public Extension MethodDistinctUntilChanged<TResult>()Overloaded. Returns an observable sequence that contains only distinct contiguous elements with a specified source. (Defined by Observable.)
Public Extension MethodDistinctUntilChanged<TResult>(IEqualityComparer<TResult>)Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the comparer. (Defined by Observable.)
Public Extension MethodDistinctUntilChanged<TResult, TKey>(Func<TResult, TKey>)Overloaded. Returns an observable sequence that contains only distinct contiguous elements according to the keySelector. (Defined by Observable.)
Public Extension MethodDistinctUntilChanged<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.)
Public Extension MethodDo<TResult>(Action<TResult>)Overloaded. Invokes an action for each element in the observable sequence. (Defined by Observable.)
Public Extension MethodDo<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.)
Public Extension MethodDo<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.)
Public Extension MethodDo<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.)
Public Extension MethodDo<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.)
Public Extension MethodElementAt<TResult>Returns the element at a specified index in a sequence. (Defined by Observable.)
Public Extension MethodElementAtOrDefault<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.)
Public Extension MethodFinally<TResult>Invokes a specified action after source observable sequence terminates normally or by an exception. (Defined by Observable.)
Public Extension MethodFirst<TResult>()Overloaded. Returns the first element of an observable sequence with a specified source. (Defined by Observable.)
Public Extension MethodFirst<TResult>(Func<TResult, Boolean>)Overloaded. Returns the first element of an observable sequence that matches the predicate. (Defined by Observable.)
Public Extension MethodFirstOrDefault<TResult>()Overloaded. Returns the first element of an observable sequence, or a default value if no value is found. (Defined by Observable.)
Public Extension MethodFirstOrDefault<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.)
Public Extension MethodFoo<TResult, R> (Defined by MyExt.)
Public Extension MethodForEach<TResult>Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. (Defined by Observable.)
Public Extension MethodGetEnumerator<TResult>Returns an enumerator that enumerates all values of the observable sequence. (Defined by Observable.)
Public Extension MethodGroupBy<TResult, TKey>(Func<TResult, TKey>)Overloaded. Groups the elements of an observable sequence according to a specified key selector function. (Defined by Observable.)
Public Extension MethodGroupBy<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.)
Public Extension MethodGroupBy<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.)
Public Extension MethodGroupBy<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.)
Public Extension MethodGroupByUntil<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.)
Public Extension MethodGroupByUntil<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.)
Public Extension MethodGroupByUntil<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.)
Public Extension MethodGroupByUntil<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.)
Public Extension MethodGroupJoin<TResult, TRight, TLeftDuration, TRightDuration, TResult>Correlates the elements of two sequences based on overlapping durations, and groups the results. (Defined by Observable.)
Public Extension MethodIgnoreElements<TResult>Ignores all values in an observable sequence leaving only the termination messages. (Defined by Observable.)
Public Extension MethodJoin<TResult, TRight, TLeftDuration, TRightDuration, TResult>Correlates the elements of two sequences based on overlapping durations. (Defined by Observable.)
Public Extension MethodLast<TResult>()Overloaded. Returns the last element of an observable sequence with a specified source. (Defined by Observable.)
Public Extension MethodLast<TResult>(Func<TResult, Boolean>)Overloaded. Returns the last element of an observable sequence that matches the predicate. (Defined by Observable.)
Public Extension MethodLastOrDefault<TResult>()Overloaded. Returns last element in the observable sequence, or a default value if no value is found. (Defined by Observable.)
Public Extension MethodLastOrDefault<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.)
Public Extension MethodLatest<TResult>Samples the most recent value in an observable sequence. (Defined by Observable.)
Public Extension MethodLongCount<TResult>Returns a Int64 that represents the total number of elements in an observable sequence. (Defined by Observable.)
Public Extension MethodMaterialize<TResult>Materializes the implicit notifications of an observable sequence as explicit notification values. (Defined by Observable.)
Public Extension MethodMax<TResult>()Overloaded. Returns the maximum element in an observable sequence. (Defined by Observable.)
Public Extension MethodMax<TResult>(IComparer<TResult>)Overloaded. Returns the maximum value in an observable sequence according to the specified comparer. (Defined by Observable.)
Public Extension MethodMaxBy<TResult, TKey>(Func<TResult, TKey>)Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.)
Public Extension MethodMaxBy<TResult, TKey>(Func<TResult, TKey>, IComparer<TKey>)Overloaded. Returns the elements in an observable sequence with the maximum key value. (Defined by Observable.)
Public Extension MethodMerge<TResult>(IObservable<TResult>)Overloaded. Merges an observable sequence of observable sequences into an observable sequence. (Defined by Observable.)
Public Extension MethodMerge<TResult>(IObservable<TResult>, IScheduler)Overloaded. Merges two observable sequences into a single observable sequence. (Defined by Observable.)
Public Extension MethodMin<TResult>()Overloaded. Returns the minimum element in an observable sequence. (Defined by Observable.)
Public Extension MethodMin<TResult>(IComparer<TResult>)Overloaded. Returns the minimum value in an observable sequence according to the specified comparer. (Defined by Observable.)
Public Extension MethodMinBy<TResult, TKey>(Func<TResult, TKey>)Overloaded. Returns the elements in an observable sequence with the minimum key value. (Defined by Observable.)
Public Extension MethodMinBy<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.)
Public Extension MethodMostRecent<TResult>Samples the most recent value in an observable sequence. (Defined by Observable.)
Public Extension MethodMulticast<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.)
Public Extension MethodMulticast<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.)
Public Extension MethodNext<TResult>Samples the next value (blocking without buffering) from in an observable sequence. (Defined by Observable.)
Public Extension MethodObserveOn<TResult>(SynchronizationContext)Overloaded. Asynchronously notify observers on the specified synchronization context. (Defined by Observable.)
Public Extension MethodObserveOn<TResult>(Control)Overloaded. (Defined by ControlObservable.)
Public Extension MethodObserveOn<TResult>(Dispatcher)Overloaded. (Defined by DispatcherObservable.)
Public Extension MethodObserveOn<TResult>(DispatcherScheduler)Overloaded. (Defined by DispatcherObservable.)
Public Extension MethodObserveOn<TResult>(IScheduler)Overloaded. Asynchronously notify observers on the specified scheduler. (Defined by Observable.)
Public Extension MethodObserveOnDispatcher<TResult> (Defined by DispatcherObservable.)
Public Extension MethodOnErrorResumeNext<TResult>Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. (Defined by Observable.)
Public Extension MethodPublish<TResult>()Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence. (Defined by Observable.)
Public Extension MethodPublish<TResult>(TResult)Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. (Defined by Observable.)
Public Extension MethodPublish<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.)
Public Extension MethodPublish<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.)
Public Extension MethodPublishLast<TResult>()Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. (Defined by Observable.)
Public Extension MethodPublishLast<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.)
Public Extension MethodRepeat<TResult>()Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.)
Public Extension MethodRepeat<TResult>(Int32)Overloaded. Repeats the observable sequence indefinitely. (Defined by Observable.)
Public Extension MethodReplay<TResult>()Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<TResult>(Int32)Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.)
Public Extension MethodReplay<TResult>(IScheduler)Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. (Defined by Observable.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<TResult>(Int32, IScheduler)Overloaded. Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications. (Defined by Observable.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodReplay<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.)
Public Extension MethodRetry<TResult>()Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.)
Public Extension MethodRetry<TResult>(Int32)Overloaded. Repeats the source observable sequence until it successfully terminates. (Defined by Observable.)
Public Extension MethodSample<TResult>(TimeSpan)Overloaded. Samples the observable sequence at each interval. (Defined by Observable.)
Public Extension MethodSample<TResult>(TimeSpan, IScheduler)Overloaded. Samples the observable sequence at each interval with the specified source, interval and scheduler. (Defined by Observable.)
Public Extension MethodSample<TResult, TSample>(IObservable<TSample>)Overloaded. Samples the observable sequence at sampling ticks with the specified source and sampler. (Defined by Observable.)
Public Extension MethodScan<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.)
Public Extension MethodScan<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.)
Public Extension MethodSelect<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.)
Public Extension MethodSelect<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSelectMany<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.)
Public Extension MethodSequenceEqual<TResult>(IObservable<TResult>)Overloaded. Determines whether two sequences are equal by comparing the elements pairwise. (Defined by Observable.)
Public Extension MethodSequenceEqual<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.)
Public Extension MethodSingle<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.)
Public Extension MethodSingle<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.)
Public Extension MethodSingleOrDefault<TResult>()Overloaded. Returns the only element of an observable sequence, or a default value if the observable sequence is empty. (Defined by Observable.)
Public Extension MethodSingleOrDefault<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.)
Public Extension MethodSkip<TResult>Bypasses a specified number of values in an observable sequence and then returns the remaining values. (Defined by Observable.)
Public Extension MethodSkipLast<TResult>Bypasses a specified number of elements at the end of an observable sequence. (Defined by Observable.)
Public Extension MethodSkipUntil<TResult, TOther>Returns the values from the source observable sequence only after the other observable sequence produces a value. (Defined by Observable.)
Public Extension MethodSkipWhile<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.)
Public Extension MethodSkipWhile<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.)
Public Extension MethodStartWith<TResult>(TResult[])Overloaded. Prepends a sequence of values to an observable sequence with the specified source and values. (Defined by Observable.)
Public Extension MethodStartWith<TResult>(IScheduler, TResult[])Overloaded. Prepends a sequence of values to an observable sequence with the specified source, scheduler and values. (Defined by Observable.)
Public Extension MethodSubscribe<TResult>()Overloaded. Evaluates the observable sequence with a specified source. (Defined by ObservableExtensions.)
Public Extension MethodSubscribe<TResult>(Action<TResult>)Overloaded. Subscribes an element handler to an observable sequence. (Defined by ObservableExtensions.)
Public Extension MethodSubscribe<TResult>(Action<TResult>, Action<Exception>)Overloaded. Subscribes an element handler and an exception handler to an observable sequence. (Defined by ObservableExtensions.)
Public Extension MethodSubscribe<TResult>(Action<TResult>, Action)Overloaded. Subscribes an element handler and a completion handler to an observable sequence. (Defined by ObservableExtensions.)
Public Extension MethodSubscribe<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.)
Public Extension MethodSubscribeOn<TResult>(SynchronizationContext)Overloaded. Asynchronously subscribes and unsubscribes observers on the specified synchronization context. (Defined by Observable.)
Public Extension MethodSubscribeOn<TResult>(Control)Overloaded. (Defined by ControlObservable.)
Public Extension MethodSubscribeOn<TResult>(Dispatcher)Overloaded. (Defined by DispatcherObservable.)
Public Extension MethodSubscribeOn<TResult>(DispatcherScheduler)Overloaded. (Defined by DispatcherObservable.)
Public Extension MethodSubscribeOn<TResult>(IScheduler)Overloaded. Asynchronously subscribes and unsubscribes observers on the specified scheduler. (Defined by Observable.)
Public Extension MethodSubscribeOnDispatcher<TResult> (Defined by DispatcherObservable.)
Public Extension MethodSynchronize<TResult>()Overloaded. Synchronizes the observable sequence. (Defined by Observable.)
Public Extension MethodSynchronize<TResult>(Object)Overloaded. Synchronizes the observable sequence. (Defined by Observable.)
Public Extension MethodTake<TResult>Returns a specified number of contiguous values from the start of an observable sequence. (Defined by Observable.)
Public Extension MethodTakeLast<TResult>Returns a specified number of contiguous elements from the end of an observable sequence. (Defined by Observable.)
Public Extension MethodTakeUntil<TResult, TOther>Returns the values from the source observable sequence until the other observable sequence produces a value. (Defined by Observable.)
Public Extension MethodTakeWhile<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.)
Public Extension MethodTakeWhile<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.)
Public Extension MethodThen<TResult, TResult>Matches when the observable sequence has an available value and projects the value. (Defined by Observable.)
Public Extension MethodThrottle<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.)
Public Extension MethodThrottle<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.)
Public Extension MethodTimeInterval<TResult>()Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source. (Defined by Observable.)
Public Extension MethodTimeInterval<TResult>(IScheduler)Overloaded. Records the time interval between consecutive values in an observable sequence with the specified source and scheduler. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(TimeSpan)Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(DateTimeOffset)Overloaded. Returns either the observable sequence or a TimeoutException if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(TimeSpan, IObservable<TResult>)Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(DateTimeOffset, IObservable<TResult>)Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(TimeSpan, IScheduler)Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(DateTimeOffset, IScheduler)Overloaded. Returns either the observable sequence or an TimeoutException if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(TimeSpan, IObservable<TResult>, IScheduler)Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimeout<TResult>(DateTimeOffset, IObservable<TResult>, IScheduler)Overloaded. Returns the source observable sequence or the other observable sequence if dueTime elapses. (Defined by Observable.)
Public Extension MethodTimestamp<TResult>()Overloaded. Records the timestamp for each value in an observable sequence with the specified source. (Defined by Observable.)
Public Extension MethodTimestamp<TResult>(IScheduler)Overloaded. Records the timestamp for each value in an observable sequence with the specified source and scheduler. (Defined by Observable.)
Public Extension MethodToArray<TResult>Creates an array from an observable sequence. (Defined by Observable.)
Public Extension MethodToDictionary<TResult, TKey>(Func<TResult, TKey>)Overloaded. Creates a dictionary from an observable sequence according to a specified key selector function. (Defined by Observable.)
Public Extension MethodToDictionary<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.)
Public Extension MethodToDictionary<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.)
Public Extension MethodToDictionary<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.)
Public Extension MethodToEnumerable<TResult>Converts an observable sequence to an enumerable sequence. (Defined by Observable.)
Public Extension MethodToEvent<TResult>Exposes an observable sequence as an object with a .NET event with a specified source. (Defined by Observable.)
Public Extension MethodToList<TResult>Creates a list from an observable sequence. (Defined by Observable.)
Public Extension MethodToLookup<TResult, TKey>(Func<TResult, TKey>)Overloaded. Creates a lookup from an observable sequence according to a specified key selector function. (Defined by Observable.)
Public Extension MethodToLookup<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.)
Public Extension MethodToLookup<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.)
Public Extension MethodToLookup<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.)
Public Extension MethodToNotifier<TSource> Creates a notification callback from an observer. (Defined by Observer.)
Public Extension MethodToTask<TResult>()Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.)
Public Extension MethodToTask<TResult>(Object)Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.)
Public Extension MethodToTask<TResult>(CancellationToken)Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.)
Public Extension MethodToTask<TResult>(CancellationToken, Object)Overloaded. Returns a task that contains the last value of the observable sequence. (Defined by TaskObservableExtensions.)
Public Extension MethodWhere<TResult>(Func<TResult, Boolean>)Overloaded. Filters the elements of an observable sequence based on a predicate. (Defined by Observable.)
Public Extension MethodWhere<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<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.)
Public Extension MethodWindow<TResult, TWindowClosing>(Func<IObservable<TWindowClosing>>)Overloaded. Projects each element of an observable sequence into consecutive non-overlapping windows. (Defined by Observable.)
Public Extension MethodWindow<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.)
Public Extension MethodZip<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.)
Public Extension MethodZip<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

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.

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.
Show:
© 2014 Microsoft