Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.2.0
public void RegisterForDisposal( Object disposable )
Public Sub RegisterForDisposal ( disposable As Object )
- Type: SystemObject
The instance that should be disposed when the scope ends.
|ArgumentNullException||Thrown when one of the arguments is a null reference (Nothing in VB).|
|ArgumentException||Thrown when the argument neither implements IDisposable nor IAsyncDisposable.|
|ObjectDisposedException||Thrown when the scope has been disposed.|
Instances that are registered for disposal, will be disposed in opposite order of registration and they are guaranteed to be disposed when Dispose is called (even when exceptions are thrown). This mimics the behavior of the C# and VB
Thread safety: Calls to this method are thread safe.