<PackageReference Include="System.Reactive" Version="4.1.0" />

CompositeDisposable

Represents a group of disposable resources that are disposed together.
public int Count { get; }

Gets the number of disposables contained in the CompositeDisposable.

public bool IsDisposed { get; }

Gets a value that indicates whether the object is disposed.

public bool IsReadOnly { get; }

Always returns false.

Initializes a new instance of the CompositeDisposable class with no disposables contained by it initially.

public CompositeDisposable(int capacity)

Initializes a new instance of the CompositeDisposable class with the specified number of disposables.

public CompositeDisposable(IDisposable[] disposables)

Initializes a new instance of the CompositeDisposable class from a group of disposables.

Initializes a new instance of the CompositeDisposable class from a group of disposables.

public void Add(IDisposable item)

Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.

public void Clear()

Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.

public bool Contains(IDisposable item)

Determines whether the CompositeDisposable contains a specific disposable.

public void CopyTo(IDisposable[] array, int arrayIndex)

Copies the disposables contained in the CompositeDisposable to an array, starting at a particular array index.

public void Dispose()

Disposes all disposables in the group and removes them from the group.

Returns an enumerator that iterates through the CompositeDisposable.

public bool Remove(IDisposable item)

Removes and disposes the first occurrence of a disposable from the CompositeDisposable.