Exemplo n.º 1
0
        /// <summary>
        /// Returns a <see cref="Stream"/> that wraps the <see cref="PipeWriter"/>.
        /// </summary>
        /// <param name="leaveOpen">Optional flag indicating disposing returned <see cref="Stream"/> won't complete <see cref="PipeWriter"/>.</param>
        /// <returns>The <see cref="Stream"/>.</returns>
        public virtual Stream AsStream(bool leaveOpen = false)
        {
            if (_stream == null)
            {
                _stream = new PipeWriterStream(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="PipeWriter"/>.
 /// </summary>
 /// <returns>The <see cref="Stream"/>.</returns>
 public virtual Stream AsStream()
 {
     return(_stream ?? (_stream = new PipeWriterStream(this)));
 }