Class AggregateDisposable
An aggregate of IDisposables that allows to dispose several disposables in one operation.
Implements
Namespace: Sartorius.SAF.Infrastructure
Assembly: Sartorius.SAF.dll
Syntax
public sealed class AggregateDisposable : IDisposable
Constructors
View SourceAggregateDisposable()
Initializes a new instance of the AggregateDisposable class.
Declaration
public AggregateDisposable()
AggregateDisposable(IEnumerable<IDisposable>)
Initializes a new instance of the AggregateDisposable class with the specified child IDisposables.
Declaration
public AggregateDisposable(IEnumerable<IDisposable> disposables)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IDisposable> | disposables | An enumerable of IDisposable instances. |
AggregateDisposable(params IDisposable[])
Initializes a new instance of the AggregateDisposable class with the specified child IDisposables.
Declaration
public AggregateDisposable(params IDisposable[] disposables)
Parameters
| Type | Name | Description |
|---|---|---|
| IDisposable[] | disposables | An array of IDisposable instances. |
Methods
View SourceAdd(IDisposable)
Add an instance of IDisposable to the child items.
Declaration
public void Add(IDisposable disposable)
Parameters
| Type | Name | Description |
|---|---|---|
| IDisposable | disposable | A instance. |
AddRange(IEnumerable<IDisposable>)
Add a range of disposables.
Declaration
public void AddRange(IEnumerable<IDisposable> disposables)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IDisposable> | disposables | A list of disposables. |
Dispose()
Disposes all child IDisposables.
Declaration
public void Dispose()
Exceptions
| Type | Condition |
|---|---|
| AggregateException | Thrown if more than one of the child disposables throws an exception during Dispose(). If a single child disposable throws an exception this exception gets rethrown. |