Click or drag to resize
Ab4d.SharpEngine logo

DisposeList Class

DisposeList contains a list of IDisposable objects that are automatically disposed when DisposeList is disposed. The order of disposal is reversed from the order in which the objects were added to the list (first object is disposed last).
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.UtilitiesDisposeList

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 1.0.8740+deb2991acfe86a95cca780cd4f82bcae2805c1a5
Syntax
C#
public sealed class DisposeList : IDisposable

The DisposeList type exposes the following members.

Constructors
 NameDescription
Public methodDisposeList Constructor
Top
Methods
 NameDescription
Public methodAdd Adds object to this DisposeList
Public methodDispose Disposes all objects in this DisposeList
Public methodRemove Removes object from this DisposeList
Top
Remarks

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.

See Also