Show / Hide Table of Contents

Class StableCompositeSubscription

Composite subscription that can hold a dynamic number of inner subscriptions.

Inheritance
System.Object
StableCompositeSubscription
Implements
ICompositeSubscription
System.Collections.Generic.IEnumerable<ISubscription>
System.Collections.IEnumerable
ISubscription
System.IDisposable
Namespace: Reaqtive
Assembly: Reaqtive.Core.dll
Syntax
public sealed class StableCompositeSubscription : Object, ICompositeSubscription, IEnumerable<ISubscription>, IEnumerable, ISubscription, IDisposable
Remarks

As the name suggests, it is expected that the subscription set is relatively stable. Adding and removing subscriptions results in the allocation of a new array, followed by a linear copy over. For a composite subscription with a more dynamic scenario, use CompositeSubscription.

Constructors

StableCompositeSubscription(ISubscription[])

Creates a new composite subscription with the specified inner subscriptions.

Declaration
public StableCompositeSubscription(params ISubscription[] subscriptions)
Parameters
Type Name Description
ISubscription[] subscriptions

Inner subscriptions.

StableCompositeSubscription(IEnumerable<ISubscription>)

Creates a new composite subscription with the specified inner subscriptions.

Declaration
public StableCompositeSubscription(IEnumerable<ISubscription> subscriptions)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ISubscription> subscriptions

Inner subscriptions.

Properties

Count

Gets the number of inner subscriptions.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
Remarks

This number can change immediate after being read in the presence of multi-threaded usage.

Methods

Accept(ISubscriptionVisitor)

Accepts a visitor that will be dispatched through the subscription, causing all inner subscriptions to be visited.

Declaration
public void Accept(ISubscriptionVisitor visitor)
Parameters
Type Name Description
ISubscriptionVisitor visitor

Visitor to accept.

Add(ISubscription)

Adds the specified subscription to the list of subscriptions that this instance manages. If the CompositeSubscription is already disposed, then the passed in subscription also gets disposed.

Declaration
public void Add(ISubscription subscription)
Parameters
Type Name Description
ISubscription subscription

Subscription to add.

AddRange(IEnumerable<ISubscription>)

Adds the specified subscriptions to the list of subscriptions that this instance manages. If the CompositeSubscription is already disposed, then the passed in subscriptions also get disposed.

Declaration
public void AddRange(IEnumerable<ISubscription> subscriptions)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ISubscription> subscriptions

Subscriptions to add.

Dispose()

Disposes the composite subscription, causing all inner subscriptions to be disposed.

Declaration
public void Dispose()

GetEnumerator()

Gets an enumerator to iterate over the inner subscriptions.

Declaration
public IEnumerator<ISubscription> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<ISubscription>

Enumerator to iterate over a snapshot of the inner subscriptions.

Remarks

This method causes a snapshot of inner subscriptions to be created. While iteration is in progress, subscriptions may be added or removed due to multi-threaded accesses.

Remove(ISubscription)

Removes the specified subscription from the list of subscriptions that this instance manages and disposes the removed subscription, if found.

Declaration
public void Remove(ISubscription subscription)
Parameters
Type Name Description
ISubscription subscription

Subscription to remove.

Implements

ICompositeSubscription
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable
ISubscription
System.IDisposable
In This Article
Back to top Generated by DocFX