Dispose | |
public sealed class DisposeList : IDisposable
The DisposeList type exposes the following members.
| Name | Description | |
|---|---|---|
| DisposeList | Constructor |
| Name | Description | |
|---|---|---|
| Add | Adds object to this DisposeList | |
| Dispose | Disposes all objects in this DisposeList. The objects are disposed in the reverse order in which they were added to the list (first object is disposed last). | |
| Remove | Removes object from this DisposeList |
NOTE:
We do not check if the objectToDispose is already in the _disposables list
This check is quite expensive - we need to go through the whole list each time.
Therefore the objects that are added to DisposeList must check if they are already disposed and should not dispose themselves more than once.