Skip to content

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

Overloads

  • 1. public CompositeDisposableAsync()
  • 2. public CompositeDisposableAsync(int capacity)
  • 3. public CompositeDisposableAsync(params IAsyncDisposable[] disposables)
  • 4. public CompositeDisposableAsync(IEnumerable<IAsyncDisposable> disposables)

1. Overload

public CompositeDisposableAsync()

View source

Summary: Initializes a new instance of the CompositeDisposableAsync class. The backing array is allocated lazily on the first AddAsync call; an unused composite costs only its instance header + gate.

2. Overload

public CompositeDisposableAsync(int capacity)

View source

Summary: Initializes a new instance of the CompositeDisposableAsync class with the specified initial capacity.

Parameters

NameTypeDescription
capacityintThe number of elements that the collection can initially store. Must be greater than or equal to 0.

Exceptions

TypeCondition
System.ArgumentOutOfRangeExceptionThrown when capacity is less than 0.

3. Overload

public CompositeDisposableAsync(params IAsyncDisposable[] disposables)

View source

Summary: Initializes a new instance of the CompositeDisposableAsync class that contains the specified disposables — the backing array is sized exactly so no resize occurs.

Parameters

NameTypeDescription
params disposablesIAsyncDisposable[]An array of objects implementing IAsyncDisposable.

4. Overload

public CompositeDisposableAsync(IEnumerable<IAsyncDisposable> disposables)

View source

Summary: Initializes a new instance of the CompositeDisposableAsync class that contains the specified disposables. The backing array is sized exactly when disposables implements ICollection; otherwise it grows from the default capacity.

Parameters

NameTypeDescription
disposablesIEnumerableThe collection of IAsyncDisposable instances to include.