Class DisposableObject
General-purpose base class for objects that need to be disposed
Inheritance
System.Object
DisposableObject
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Azos
Assembly: Azos.dll
Syntax
[Serializable]
public abstract class DisposableObject : IDisposable
Properties
Disposed
Indicates whether this object Dispose() has been called and dispose started (but may not have finished yet). Thread safe
Declaration
public bool Disposed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Destructor()
Override this method to do actual destructor work. Destructor should not throw exceptions - must handle internally
Declaration
protected virtual void Destructor()
Dispose()
Deterministically disposes object. DO NOT OVERRIDE this method, override Destructor() instead
Declaration
public void Dispose()
DisposeAndNull<T>(ref T)
Checks to see if the IDisposable reference is not null and sets it to null in a thread-safe way then calls Dispose(). Returns false if it is already null or not the original reference
Declaration
public static bool DisposeAndNull<T>(ref T obj)
where T : class, IDisposable
Parameters
Type | Name | Description |
---|---|---|
T | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
T |
EnsureObjectNotDisposed()
Checks to see whether object dispose started or has already been disposed and throws an exception if Dispose() was called
Declaration
public void EnsureObjectNotDisposed()
Finalize()
Declaration
protected void Finalize()
Implements
System.IDisposable