/// <summary> /// Call the dispose method if the object is not null and was not already disposed /// </summary> /// <param name="obj"></param> public static void SafeDispose(this IDisposed obj) { if (obj != null && !obj.Disposed) { obj.Dispose(); } }
public static void CheckDisposed(this IDisposed dispose) { if (false.Equals(object.ReferenceEquals(dispose, null)) && dispose.IsDisposed) { throw new System.ObjectDisposedException("IDisposedExtensions.CheckDisposed,true"); } }
public static void CheckDisposed(this IDisposed dispose) { if (dispose != null && dispose.IsDisposed) { throw new System.ObjectDisposedException("IDisposedExtensions.CheckDisposed,true"); } }
public static bool ShouldDisposed(this IDisposed dispose) { return(false.Equals(object.ReferenceEquals(dispose, null)) && dispose.ShouldDispose); }
public static bool IsNullOrDisposed(this IDisposed dispose) { return(object.ReferenceEquals(dispose, null) || dispose.IsDisposed); }
public ArgumentNullOrDisposedException(string paramName, IDisposed what) : this(paramName) { Disposed = what; }
public ArgumentNullOrDisposedException(IDisposed what) : this(string.Empty, what) { }
public ArgumentNullOrDisposedException(string paramName, IDisposed what, int stackFrameDepth, bool fNeedFileInfo) { //Warning, memory consumption... StackFrame = new System.Diagnostics.StackFrame(stackFrameDepth, fNeedFileInfo); }
public static bool ShouldDisposed(this IDisposed dispose) { return(dispose != null && dispose.ShouldDispose); }
public static bool IsNullOrDisposed(this IDisposed dispose) { return(null == dispose || dispose.IsDisposed); }
public LinkedDisposableWrapper(IDisposed linkTo, TValue value) : base(linkTo, value) { }