Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public static void AssertObjectIsNotDisposed(IDisposalState value)
 {
     Guard.AssertObjectIsNotDisposed(value, null);
 }