/// <summary> /// Throws an exception if the specified object has been disposed. /// </summary> /// <param name="obj">The object in question.</param> public static void NotDisposed( DisposableObject obj ) { if ( obj.IsDisposed ) { throw new ObjectDisposedException( obj.GetType().Name ); } }
/// <summary> /// 如果对象已经释放,则引发 ObjectDisposedException 异常 /// </summary> /// <param name="value">参数值</param> public static void ThrowIfDisposed(this DisposableObject value) { if (value.IsDisposed) { throw new ObjectDisposedException(value.GetType().Name); } }
/// <summary> /// Throws an exception if the specified object has been disposed. /// </summary> /// <param name="obj">The object in question.</param> public static void NotDisposed(DisposableObject obj) { if (obj.IsDisposed) { throw new ObjectDisposedException(obj.GetType().Name); } }