CompositeDisposable Class

Represents a group of Disposables that are disposed together.

Inheritance Hierarchy

System.Object
  System.Reactive.Disposables.CompositeDisposable

Namespace:  System.Reactive.Disposables
Assembly:  System.Reactive (in System.Reactive.dll)

Syntax

'Declaration
Public NotInheritable Class CompositeDisposable _
    Implements ICollection(Of IDisposable), IEnumerable(Of IDisposable),  _
    IEnumerable, IDisposable
'Usage
Dim instance As CompositeDisposable
public sealed class CompositeDisposable : ICollection<IDisposable>, 
    IEnumerable<IDisposable>, IEnumerable, IDisposable
public ref class CompositeDisposable sealed : ICollection<IDisposable^>, 
    IEnumerable<IDisposable^>, IEnumerable, IDisposable
[<SealedAttribute>]
type CompositeDisposable =  
    class
        interface ICollection<IDisposable>
        interface IEnumerable<IDisposable>
        interface IEnumerable
        interface IDisposable
    end
public final class CompositeDisposable implements ICollection<IDisposable>, IEnumerable<IDisposable>, IEnumerable, IDisposable

The CompositeDisposable type exposes the following members.

Constructors

  Name Description
Public method CompositeDisposable() Initializes a new instance of the CompositeDisposable class from a group of disposables.
Public method CompositeDisposable(IEnumerable<IDisposable>) Initializes a new instance of the CompositeDisposable class from a group of disposables.
Public method CompositeDisposable(IDisposable[]) Initializes a new instance of the CompositeDisposable class from a group of disposables.
Public method CompositeDisposable(Int32) Initializes a new instance of the CompositeDisposable class with the specified number of disposables.

Top

Properties

  Name Description
Public property Count Gets the number of disposables contained in the CompositeDisposable.
Public property IsDisposed Gets a value that indicates whether the object is disposed.
Public property IsReadOnly Always returns false.

Top

Methods

  Name Description
Public method Add Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
Public method Clear Removes and disposes all disposables from the GroupDisposable, but does not dispose the CompositeDisposable.
Public method Contains Determines whether the CompositeDisposable contains a specific disposable.
Public method CopyTo Copies the disposables contained in the CompositeDisposable to an array, starting at a particular array index.
Public method Dispose Disposes all disposables in the group and removes them from the group.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetEnumerator Returns an enumerator that iterates through the CompositeDisposable.
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method Remove Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
Public method ToString (Inherited from Object.)

Top

Extension Methods

  Name Description
Public Extension Method AssertEqual<IDisposable>(IEnumerable<IDisposable>) Overloaded. (Defined by Extensions.)
Public Extension Method AssertEqual<IDisposable>(IDisposable[]) Overloaded. (Defined by Extensions.)
Public Extension Method Subscribe<IDisposable>(IObserver<IDisposable>) Overloaded. Subscribes an observer to an enumerable sequence with the specified source and observer. (Defined by Observable.)
Public Extension Method Subscribe<IDisposable>(IObserver<IDisposable>, IScheduler) Overloaded. Subscribes an observer to an enumerable sequence with the specified source and observer. (Defined by Observable.)
Public Extension Method ToObservable<IDisposable>() Overloaded. Converts an enumerable sequence to an observable sequence with a specified source. (Defined by Observable.)
Public Extension Method ToObservable<IDisposable>(IScheduler) Overloaded. Converts an enumerable sequence to an observable sequence with a specified source and scheduler. (Defined by Observable.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator Returns an enumerator that iterates through the CompositeDisposable.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Reactive.Disposables Namespace