Skip to content

MultipleDisposable class

Attributes: [DebuggerDisplay("{DebuggerDisplay,nq}")]

Defined in

Namespace: ReactiveUI.Primitives.Disposables Assembly: ReactiveUI.Disposables.dll Full name: ReactiveUI.Primitives.Disposables.MultipleDisposable Modifiers: public

Summary

View source

A disposable pocket that contains a set of disposables and disposes them together.

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Class hierarchy
classDiagram
class MultipleDisposable
class IsDisposed {
    <>
}
IsDisposed <|.. MultipleDisposable
class IDisposable {
    <>
}
IDisposable <|.. MultipleDisposable
class ICollection~IDisposable~ {
    <>
}
ICollection~IDisposable~ <|.. MultipleDisposable
class IEnumerable~IDisposable~ {
    <>
}
IEnumerable~IDisposable~ <|.. MultipleDisposable
class IEnumerable {
    <>
}
IEnumerable <|.. MultipleDisposable

Implements: IsDisposed, IDisposable, ICollection, IEnumerable, IEnumerable

Remarks

Implements ICollection over IDisposable so it can stand in for a composite disposable: it supports collection initializers, membership queries, and DisposeWith-style extension methods that accept an ICollection.

Constructors

NameSummary
.ctorInitializes a new instance of the [MultipleDisposable](# class.

Properties

NameSummary
IsDisposedGets a value indicating whether the object is disposed.
CountGets the number of disposables currently held. Returns zero once disposed.
IsReadOnlyGets a value indicating whether the collection is read-only. Always false.

Methods

NameSummary
static CreateCreates a new group of disposable resources that are disposed together.
AddAdds a disposable to the [MultipleDisposable](# or disposes it immediately if the pocket is already disposed.
RemoveRemoves and disposes the requested disposable from the pocket.
ClearRemoves and disposes every disposable currently held without disposing the group itself.
ContainsDetermines whether the group currently holds the supplied disposable.
CopyToCopies the disposables currently held into array starting at arrayIndex.
GetEnumeratorReturns an enumerator over a snapshot of the disposables currently held.
DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Derived types

Inherited members