title: C# How do I export a MemoryStream's content to the console and write the stream's content onto the console?
body: <p>The title says pretty much all.</p>
  
  <p>I am making a logging system using the "Debug" class (Debug.WriteLine, etc.), and I've attached a TextWriterTraceListener to it so it can log all the strings that has been written using Debug write functions.</p>
  
  <p>e.g:</p>
  
  <pre><code>MemoryStream stream = new MemoryStream();
  TextWriter standardOutput = new StreamWriter(stream);
  TextWriterTraceListener writer = new TextWriterTraceListener(standardOutput);
  Debug.Listeners.Add(writer);
  Debug.WriteLine("123 test");
  Console.WriteLine("Hi there!");
  //*Here add the already existing data in the stream ('stream')*
  </code></pre>
  
  <p>Any idea how to achieve this?</p>