Exemplo n.º 1
0
        /// <summary>
        /// Returns a <see cref="Stream"/> that wraps the <see cref="PipeReader"/>.
        /// </summary>
        /// <param name="leaveOpen">Optional flag indicating disposing returned <see cref="Stream"/> won't complete <see cref="PipeReader"/>.</param>
        /// <returns>The <see cref="Stream"/>.</returns>
        public virtual Stream AsStream(bool leaveOpen = false)
        {
            if (_stream == null)
            {
                _stream = new PipeReaderStream(this, leaveOpen);
            }
            else if (leaveOpen)
            {
                _stream.LeaveOpen = leaveOpen;
            }

            return(_stream);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns a <see cref="Stream"/> that wraps the <see cref="PipeReader"/>.
 /// </summary>
 /// <returns>The <see cref="Stream"/>.</returns>
 public virtual Stream AsStream()
 {
     return(_stream ?? (_stream = new PipeReaderStream(this)));
 }