internal void EnsureNotClosed()
        {
            if (!IsInClosedState)
            {
                return;
            }

            ObjectDisposedException ex = new ObjectDisposedException(SR.ObjectDisposed_AsyncInfoIsClosed);

            ex.SetHResult(E_ILLEGAL_METHOD_CALL);
            throw ex;
        }
        private Stream EnsureNotDisposed()
        {
            Stream str = _managedStream;

            if (str == null)
            {
                ObjectDisposedException ex = new ObjectDisposedException(global::Windows.Storage.Streams.SR.ObjectDisposed_CannotPerformOperation);
                ex.SetHResult(RO_E_CLOSED);
                throw ex;
            }

            return(str);
        }