private IAsyncResult BeginReadWhole(byte[] buffer, int offset, int size, AsyncCallback cb, object state)
        {
            ReadWhole_SO e_so = null;

            e_so = new ReadWhole_SO(buffer, offset, size, cb, state);
            base.NStream.BeginRead(buffer, offset, size, new AsyncCallback(this.ReadWhole_Read_End), e_so);
            return(e_so);
        }
        private void ReadWhole_Read_End(IAsyncResult ar)
        {
            ReadWhole_SO asyncState = (ReadWhole_SO)ar.AsyncState;

            try
            {
                asyncState.UpdateContext();
                asyncState.Read += base.NStream.EndRead(ar);
                if (asyncState.Read < asyncState.Size)
                {
                    base.NStream.BeginRead(asyncState.Buffer, asyncState.Offset + asyncState.Read, asyncState.Size - asyncState.Read, new AsyncCallback(this.ReadWhole_Read_End), asyncState);
                }
                else
                {
                    asyncState.SetCompleted();
                }
            }
            catch (Exception exception)
            {
                asyncState.Exception = exception;
                asyncState.SetCompleted();
            }
        }
        IAsyncResult BeginReadWhole(byte[] buffer, 
            int offset, 
            int size,
            AsyncCallback cb, 
            object state)
        {
            ReadWhole_SO stateObj = null;
            stateObj = new ReadWhole_SO(buffer, offset, size, cb, state);

            NStream.BeginRead(buffer, offset, size, 
                new AsyncCallback(ReadWhole_Read_End),
                stateObj);

            return stateObj;
        }