Skip to content

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

NameSummary
.ctorInitializes a new instance of the [BehaviorSubject](# class which creates a subject that caches its last value and starts with the specified value.

Properties

NameSummary
HasObserversIndicates whether the subject has observers subscribed to it.
IsDisposedIndicates whether the subject has been disposed.
ValueGets the current value or throws an exception.

Methods

NameSummary
TryGetValueTries to get the current value or throws an exception.
OnCompletedNotifies all subscribed observers about the end of the sequence.
OnErrorNotifies all subscribed observers about the exception.
OnNextNotifies all subscribed observers about the arrival of the specified element in the sequence.
SubscribeSubscribes an observer to the subject.
DisposeUnsubscribe all observers and release resources.
Inherited members