Esempio n. 1
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback cb, object state)
        {
            CheckDisposed();

            if (!isRead)
            {
                throw new NotSupportedException();
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (offset < 0 || offset > buffer.Length)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if (size < 0 || size > buffer.Length - offset)
            {
                throw new ArgumentOutOfRangeException("offset+size");
            }

            ReadDelegate del = ReadInternal;

#if SSHARP
            return(del.BeginInvokeEx(cb, state, buffer, offset, size));
#else
            return(del.BeginInvoke(buffer, offset, size, cb, state));
#endif
        }