public static void NotDisposed(IDisposableEx obj) { if (obj.Disposed) { throw new ObjectDisposedException(null); } }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Throws an exception if the specified object has been disposed. /// </summary> /// <param name="obj">The object in question.</param> public static void NotDisposed(IDisposableEx obj) { if (obj.IsDisposed) { throw new ObjectDisposedException(obj.GetType().Name); } }
public void Invoke(object sender, TEventArgs e) { T target = (T)this.targetRef.Target; if (target != null) { IDisposableEx disposable = target as IDisposableEx; if ((disposable != null) && disposable.IsDisposed) { this.DoUnregister(); return; } this.openHandler.Invoke(target, sender, e); } else { this.DoUnregister(); } }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Throws an exception if the specified object has been disposed. /// </summary> /// <param name="obj">The object in question.</param> public static void NotDisposed(IDisposableEx obj) { if (obj.IsDisposed) throw new ObjectDisposedException(obj.GetType().Name); }
public DisposableServiceHavingDisposableDependency(IDisposableEx disposableDep) => DisposableDep = disposableDep;