Observable class¶
Defined in
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Full name: System.Reactive.Linq.Observable
Modifiers: public static
Summary¶
Provides a set of static methods for writing in-memory queries over observable sequences.
Applies to
netstandard2.0
Methods¶
| Name | Summary |
|---|---|
| static Aggregate | Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial... |
| static All | Determines whether all elements of an observable sequence satisfy a condition. |
| static Any | Determines whether an observable sequence contains any elements. |
| static Average | Computes the average of an observable sequence of Double values. |
| static Contains | Determines whether an observable sequence contains a specified element by using the default equality comparer. |
| static Count | Returns an observable sequence containing an Int32 that represents the total number of elements in an observable sequence. |
| static ElementAt | Returns the element at a specified index in a sequence. |
| static ElementAtOrDefault | Returns the element at a specified index in a sequence or a default value if the index is out of range. |
| static FirstAsync | Returns the first element of an observable sequence. |
| static FirstOrDefaultAsync | Returns the first element of an observable sequence, or a default value if no such element exists. |
| static IsEmpty | Determines whether an observable sequence is empty. |
| static LastAsync | Returns the last element of an observable sequence. |
| static LastOrDefaultAsync | Returns the last element of an observable sequence, or a default value if no such element exists. |
| static LongCount | Returns an observable sequence containing an Int64 that represents the total number of elements in an observable sequence. |
| static Max | Returns the maximum element in an observable sequence. |
| static MaxBy | Returns the elements in an observable sequence with the maximum key value. |
| static Min | Returns the minimum element in an observable sequence. |
| static MinBy | Returns the elements in an observable sequence with the minimum key value. |
| static SequenceEqual | Determines whether two sequences are equal by comparing the elements pairwise. |
| static SingleAsync | Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence. |
| static SingleOrDefaultAsync | Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method reports an exception if there is more than one element in the observable... |
| static Sum | Computes the sum of a sequence of Double values. |
| static ToArray | Creates an array from an observable sequence. |
| static ToDictionary | Creates a dictionary from an observable sequence according to a specified key selector function. |
| static ToList | Creates a list from an observable sequence. |
| static ToLookup | Creates a lookup from an observable sequence according to a specified key selector function. |
| static FromAsyncPattern | Converts a Begin/End invoke function pair into an asynchronous function. |
| static Start | Invokes the specified function asynchronously, surfacing the result through an observable sequence. |
| static StartAsync | Invokes the asynchronous function, surfacing the result through an observable sequence. |
| static FromAsync | Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started. |
| static ToAsync | Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function. |
| static GetAwaiter | Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. This operation subscribes to the observable sequence, making it... |
| static RunAsync | Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. This operation subscribes to the observable sequence, making it... |
| static Multicast | Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. Upon connection of the connectable observable, the subject is... |
| static Publish | Returns a connectable observable sequence that shares a single subscription to the underlying sequence. This operator is a specialization of Multicast using a regular... |
| static PublishLast | Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. This operator is a specialization of Multicast using a... |
| static RefCount | Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence. |
| static AutoConnect | Automatically connect the upstream IConnectableObservable at most once when the specified number of IObservers have subscribed to this IObservable. |
| static Replay | Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications. This operator is a specialization of Multicast using a... |
| static Chunkify | Produces an enumerable sequence of consecutive (possibly empty) chunks of the source sequence. |
| static Collect | Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations. |
| static First | Returns the first element of an observable sequence. |
| static FirstOrDefault | Returns the first element of an observable sequence, or a default value if no such element exists. |
| static ForEach | Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. |
| static GetEnumerator | Returns an enumerator that enumerates all values of the observable sequence. |
| static Last | Returns the last element of an observable sequence. |
| static LastOrDefault | Returns the last element of an observable sequence, or a default value if no such element exists. |
| static Latest | Returns an enumerable sequence whose enumeration returns the latest observed element in the source observable sequence. Enumerators on the resulting sequence will never produce the same... |
| static MostRecent | Returns an enumerable sequence whose enumeration returns the most recently observed element in the source observable sequence, using the specified initial value in case no element has been sampled... |
| static Next | Returns an enumerable sequence whose enumeration blocks until the next element in the source observable sequence becomes available. Enumerators on the resulting sequence will block until... |
| static Single | Returns the only element of an observable sequence, and throws an exception if there is not exactly one element in the observable sequence. |
| static SingleOrDefault | Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method throws an exception if there is more than one element in the observable... |
| static Wait | Waits for the observable sequence to complete and returns the last element of the sequence. If the sequence terminates with an OnError notification, the exception is thrown. |
| static ObserveOn | Wraps the source sequence in order to run its observer callbacks on the specified scheduler. |
| static SubscribeOn | Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; see the remarks section for more... |
| static Synchronize | Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently. This overload is useful to "fix" an observable sequence that exhibits concurrent... |
| static Subscribe | Subscribes an observer to an enumerable sequence. |
| static ToEnumerable | Converts an observable sequence to an enumerable sequence. |
| static ToEvent | Exposes an observable sequence as an object with an Action-based .NET event. |
| static ToEventPattern | Exposes an observable sequence as an object with a .NET event, conforming to the standard .NET event pattern. |
| static ToObservable | Converts an enumerable sequence to an observable sequence. |
| static Create | Creates an observable sequence from a specified Subscribe method implementation. |
| static Defer | Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. |
| static DeferAsync | Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes. The CancellationToken passed to the asynchronous... |
| static Empty | Returns an empty observable sequence. |
| static Generate | Generates an observable sequence by running a state-driven loop producing the sequence's elements. |
| static Never | Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). |
| static Range | Generates an observable sequence of integral numbers within a specified range. |
| static Repeat | Generates an observable sequence that repeats the given element infinitely. |
| static Return | Returns an observable sequence that contains a single element. |
| static Throw | Returns an observable sequence that terminates with an exception. |
| static Using | Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. |
| static FromEventPattern | Converts a .NET event, conforming to the standard .NET event pattern based on EventHandler, to an observable sequence. Each event... |
| static FromEvent | Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence. ... |
| static ForEachAsync | Invokes an action for each element in the observable sequence, and returns a Task object that will get signaled when the sequence terminates. |
| static Case | Uses selector to determine which source in sources to return, choosing defaultSource if no match is found. |
| static DoWhile | Repeats the given source as long as the specified condition holds, where the condition is evaluated after each repeated source completed. |
| static For | Concatenates the observable sequences obtained by running the resultSelector for each element in the given enumerable source. |
| static If | If the specified condition evaluates true, select the thenSource sequence. Otherwise, select the elseSource sequence. |
| static While | Repeats the given source as long as the specified condition holds, where the condition is evaluated before each repeated source is subscribed to. |
| static And | Creates a pattern that matches when both observable sequences have an available element. |
| static Then | Matches when the observable sequence has an available element and projects the element by invoking the selector function. |
| static When | Joins together the results from several patterns. |
| static CombineLatest | Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. |
| static Amb | Propagates the observable sequence that reacts first. |
| static Buffer | Projects each element of an observable sequence into consecutive non-overlapping buffers. |
| static Catch | Continues an observable sequence that is terminated by an exception of the specified type with the observable sequence produced by the handler. |
| static Concat | Concatenates the second observable sequence to the first observable sequence upon successful termination of the first. |
| static Merge | Merges elements from all inner observable sequences into a single observable sequence. |
| static OnErrorResumeNext | Concatenates the second observable sequence to the first observable sequence upon successful or exceptional termination of the first. |
| static SkipUntil | Returns the elements from the source observable sequence only after the other observable sequence produces an element. Starting from Rx.NET 4.0, this will subscribe to other before subscribing to... |
| static Switch | Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. Each time a new inner... |
| static TakeUntil | Returns the elements from the source observable sequence until the other observable sequence produces an element. |
| static Window | Projects each element of an observable sequence into consecutive non-overlapping windows. |
| static WithLatestFrom | Merges two observable sequences into one observable sequence by combining each element from the first source with the latest element from the second source, if any. Starting from Rx.NET 4.0, this... |
| static Zip | Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion. |
| static Append | Append a value to an observable sequence. |
| static AsObservable | Hides the identity of an observable sequence. |
| static ResetExceptionDispatchState | Propagates all messages, but if source produces an error, this updates the dispatch state of the Exception to reflect the current... |
| static Dematerialize | Dematerializes the explicit notification values of an observable sequence as implicit notifications. |
| static DistinctUntilChanged | Returns an observable sequence that contains only distinct contiguous elements. |
| static Do | Invokes an action for each element in the observable sequence, and propagates all observer messages through the result sequence. This method can be used for debugging, logging, etc. of... |
| static Finally | Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. |
| static IgnoreElements | Ignores all elements in an observable sequence leaving only the termination messages. |
| static Materialize | Materializes the implicit notifications of an observable sequence as explicit notification values. |
| static Prepend | Prepend a value to an observable sequence. |
| static RepeatWhen | Repeatedly resubscribes to the source observable after a normal completion and when the observable returned by a handler produces an arbitrary item. |
| static Retry | Repeats the source observable sequence until it successfully terminates. |
| static RetryWhen | Retries (resubscribes to) the source observable after a failure and when the observable returned by a handler produces an arbitrary item. |
| static Scan | Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. For aggregation behavior with no... |
| static SkipLast | Bypasses a specified number of elements at the end of an observable sequence. |
| static StartWith | Prepends a sequence of values to an observable sequence. |
| static TakeLast | Returns a specified number of contiguous elements from the end of an observable sequence. |
| static TakeLastBuffer | Returns a list with the specified number of contiguous elements from the end of an observable sequence. |
| static Cast | Converts the elements of an observable sequence to the specified type. |
| static DefaultIfEmpty | Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty. |
| static Distinct | Returns an observable sequence that contains only distinct elements. |
| static GroupBy | Groups the elements of an observable sequence according to a specified key selector function. |
| static GroupByUntil | 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. A duration... |
| static GroupJoin | Correlates the elements of two sequences based on overlapping durations, and groups the results. |
| static Join | Correlates the elements of two sequences based on overlapping durations. |
| static OfType | Filters the elements of an observable sequence based on the specified type. |
| static Select | Projects each element of an observable sequence into a new form. |
| static SelectMany | Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. |
| static Skip | Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. |
| static SkipWhile | Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. |
| static Take | Returns a specified number of contiguous elements from the start of an observable sequence. |
| static TakeWhile | Returns elements from an observable sequence as long as a specified condition is true. |
| static Where | Filters the elements of an observable sequence based on a predicate. |
| static Delay | Time shifts the observable sequence by the specified relative time duration. The relative time intervals between the values are preserved. |
| static DelaySubscription | Time shifts the observable sequence by delaying the subscription with the specified relative time duration. |
| static Interval | Returns an observable sequence that produces a value after each period. |
| static Sample | Samples the observable sequence at each interval. Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting... |
| static Throttle | Ignores elements from an observable sequence which are followed by another element within a specified relative time duration. |
| static TimeInterval | Records the time interval between consecutive elements in an observable sequence. |
| static Timeout | Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a... |
| static Timer | Returns an observable sequence that produces a single value after the specified relative due time has elapsed. |
| static Timestamp | Timestamps each element in an observable sequence using the local system clock. |