Exemple #1
0
 public static void DisposedIf <TDisposable>(
     bool disposed,
     [NotNull] TDisposable thisReference)
     where TDisposable : IDisposable
 {
     if (disposed)
     {
         throw CodeExceptions.ObjectDisposed(thisReference.GetType());
     }
 }
Exemple #2
0
 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());
     }
 }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
 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);
     }
 }