Class ResourceSubject<T>
Represents an expression builder that stores and broadcasts the last disposable value of an observable sequence to all subscribed and future observers. The value is disposed when the containing context is closed.
ResourceSubject
stores and passes the single last value emitted by the source sequence to each subscribed observer. The value is also only sent out after the source sequence terminates. If the source sequence does not emit any values, ResourceSubject
will also complete without emitting any values.
Warning
The type of the stored value must be IDisposable. When the enclosing workflow scope is terminated, the value will be disposed to free any allocated resources, such as file or memory handles.
Any observers which subscribe after the source sequence terminates will immediately receive the stored value. If the source sequence terminates with an error, ResourceSubject
will not emit any values but will pass along the error notification to all observers.
[WorkflowElementIcon("ResourceSubject")]
public class ResourceSubject<T> : SubjectBuilder<T>, IExpressionBuilder, INamedElement where T : class, IDisposable
Type Parameters
T
The type of the disposable resource stored by the subject.
- Inheritance
-
ResourceSubject<T>
- Implements
- Inherited Members
- Extension Methods
Methods
CreateSubject()
Creates a shared subject that stores and broadcasts the last disposable value of an observable sequence to all subscribed and future observers. The value is disposed when the containing context is closed.
protected override ISubject<T> CreateSubject()
Returns
- ISubject<T>
A new instance of ISubject<T>.