Class EventSubject<T>
- Namespace
- CsCom.Runtime
- Assembly
- CsCom.Runtime.dll
A minimal hot observable that pushes the values it receives to its subscribers. The event sinks generated with the
observable event style expose an EventSubject<T> for each event.
public sealed class EventSubject<T> : EventSubject, IObservable<T>
Type Parameters
TThe type of the values.
- Inheritance
-
EventSubject<T>
- Implements
-
IObservable<T>
- Inherited Members
Methods
OnCompleted()
Notifies the subscribers that no more values will be pushed and removes them: every one of them, also when one throws. Once all of them are notified, the exception is thrown as it is, or an AggregateException of them when several threw. Later subscribers are notified immediately.
public void OnCompleted()
OnNext(T)
Pushes a value to the subscribers, in the order of their subscriptions. An exception thrown by a subscriber is propagated, and the later subscribers do not get the value, like the handlers of a .NET event.
public void OnNext(T value)
Parameters
valueTThe value.
Remarks
Unlike OnCompleted(), which notifies every subscriber: a subscriber that missed a value still gets the next ones, but one that missed the completion would never be completed.
Subscribe(IObserver<T>)
Notifies the provider that an observer is to receive notifications.
public IDisposable Subscribe(IObserver<T> observer)
Parameters
observerIObserver<T>The object that is to receive notifications.
Returns
- IDisposable
A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.