Show / Hide Table of Contents

Class CompositeSubscription

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

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

Constructors

CompositeSubscription(ISubscription[])

Creates a new composite subscription with the specified inner subscriptions.

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

Inner subscriptions.

CompositeSubscription(IEnumerable<ISubscription>)

Creates a new composite subscription with the specified inner subscriptions.

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

Inner subscriptions.

CompositeSubscription(Int32)

Creates a new composite subscription with the specified initial capacity.

Declaration
public CompositeSubscription(int capacity)
Parameters
Type Name Description
System.Int32 capacity

Initial capacity of the number of inner subscriptions the composite subscription can hold.

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.

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