title: Efficiently write ReadOnlySequence to Stream
body: <p>Reading data using a <code>PipeReader</code> returns a <code>ReadResult</code> containing the requested data as a <code>ReadOnlySequence&lt;byte&gt;</code>. Currently I am using this (simplified) snippet to write the data fetched from the reader to my target stream:</p>
  <pre><code>var data = (await pipeReader.ReadAsync(cancellationToken)).Buffer;
  
  // lots of parsing, advancing, etc.
  
  var position = data.GetPosition(0);
  
  while (data.TryGet(ref position, out var memory))
  {
      await body.WriteAsync(memory);
  }
  </code></pre>
  <p>This seems to be a lot of code for such a basic task, which I would usually expect to be a one-liner in .NET. Analyzing the overloads provided by <code>Stream</code> I fail to see how this functionality can be achieved with less code.</p>
  <p>Is there some kind of extension method I am missing?</p>