BehaviorSubject class¶
Defined in
Namespace: System.Reactive.Subjects
Assembly: System.Reactive.dll
Full name: System.Reactive.Subjects.BehaviorSubject<T>
Modifiers: public sealed
Summary¶
Represents a value that changes over time.
Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
Applies to
netstandard2.0
Class hierarchy
classDiagram
class BehaviorSubject~T~
class SubjectBase~T~
SubjectBase~T~ <|-- BehaviorSubject~T~
Inherits from: SubjectBase
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [BehaviorSubject](# class which creates a subject that caches its last value and starts with the specified value. |
Properties¶
| Name | Summary |
|---|---|
| HasObservers | Indicates whether the subject has observers subscribed to it. |
| IsDisposed | Indicates whether the subject has been disposed. |
| Value | Gets the current value or throws an exception. |
Methods¶
| Name | Summary |
|---|---|
| TryGetValue | Tries to get the current value or throws an exception. |
| OnCompleted | Notifies all subscribed observers about the end of the sequence. |
| OnError | Notifies all subscribed observers about the exception. |
| OnNext | Notifies all subscribed observers about the arrival of the specified element in the sequence. |
| Subscribe | Subscribes an observer to the subject. |
| Dispose | Unsubscribe all observers and release resources. |