public static void DisposedIf <TDisposable>( bool disposed, [NotNull] TDisposable thisReference) where TDisposable : IDisposable { if (disposed) { throw CodeExceptions.ObjectDisposed(thisReference.GetType()); } }
public static void DisposedIfNull <TResource, TDisposable>( [CanBeNull] TResource resource, [NotNull] TDisposable thisReference) where TResource : class where TDisposable : IDisposable { if (resource == null) { throw CodeExceptions.ObjectDisposed(thisReference.GetType()); } }
public static void DisposedIf <TDisposable>( bool disposed, [NotNull] TDisposable thisReference, [NotNull] string messageFormat, [CanBeNull] params object[] args) where TDisposable : IDisposable { if (disposed) { throw CodeExceptions.ObjectDisposed(thisReference.GetType(), messageFormat, args); } }
public static void DisposedIfNull <TResource, TDisposable>( [CanBeNull] TResource resource, [NotNull] TDisposable thisReference, [NotNull] string messageFormat, [CanBeNull] params object[] args) where TResource : class where TDisposable : IDisposable { if (resource == null) { throw CodeExceptions.ObjectDisposed(thisReference.GetType(), messageFormat, args); } }