public static bool AssertIsAlive(this IDisposalState state) { if (state is null) { throw new ArgumentNullException(nameof(state)); } if (state.WasDisposed) { throw new ObjectDisposedException(state.GetType().ToString()); } return(true); }
public static void AssertObjectIsNotDisposed(IDisposalState instance, string message) { Guard.AssertArgumentIsNotNull(instance, nameof(instance)); if (instance.IsDisposed) { if (message == null) { throw new ObjectDisposedException(instance.ToString()); } throw new ObjectDisposedException(instance.ToString(), message); } }
public static void AssertObjectIsNotDisposed(IDisposalState value) { Guard.AssertObjectIsNotDisposed(value, null); }