Disposable<T>
Namespace: SnowBank.Reactive.Disposables · class
Implements: IDisposable<T>, IDisposable
Token that wraps any value into an IDisposable instance
Remarks
The encapsulated value may or may not implement . If it does, the wrapper can be configured to forward or block the caller to the inner method.
Constructors
Disposable<T>
Disposable<T>(T value)
Encapsulates an object, with a lifetime that is tied to the wrapper's lifetime
value— Instance that should be disposed (if it implementsIDisposable) when the wrapper is itself disposed.
Disposable<T>(T value, bool preventDisposition)
Encapsulates an object, with a lifetime that may or may not be tied to the wrapper's lifetime
value— Instance that should be disposed (if it implementsIDisposable) when the wrapper is itself disposed andpreventDispositionisfalse.preventDisposition— Iftrue, disposing the wrapper will NOT call Dispose onvalue
Disposable<T>(T value, Action<T> onDispose)
Encapsulates an object, with a custom cleanup handler
value— Instance that will be encapsulatedonDispose— Action that will be called (only once) when the wrapper is disposed, withvalueas its first argument.
Disposable<T>(T value, Action<T, object> onDispose, object state)
Encapsulates an object, with a custom cleanup handler
value— Instance that will be encapsulatedonDispose— Action that will be called (only once) when the wrapper is disposed, withvalueas its first argument, andstateas its second arguemnt.state— Optional state that will be passed to the callback.
Properties
Disposed
bool Disposed { get; }
Tests if the instance has already been disposed (true), or if it is still alive (false)
Value
T Value { get; }
Encapsulated value
Methods
Dispose
void Dispose()
Equals
bool Equals(object obj)
GetHashCode
int GetHashCode()
ToString
string ToString()