title: .NET streams, passing streams between objects, best practices (C#)
body: <p>I'm currently writing a little toy assembler in c# (going through <a href="http://www1.idc.ac.il/tecs/" rel="noreferrer">the elements of computing systems book</a>. Really good book by the way.)</p>
  
  <p>The assembler takes an input file path and removes junk (comments etc) lines.</p>
  
  <p>The file is then passed to a parser then finally to a another module that creates the binary code.</p>
  
  <p>This isn't too complicated, but I'd like not to have to write out a temporary file to the filesystem every time one object has finished it's processing of the input file. </p>
  
  <p>I'd like to just pass the stream onto the next object. 
  I originally thought each class involved in the parsing / junk removing would implement IDisposable but I think this means I can't pass the stream on the next object for processing (the stream would be closed, unless I keep it all in one using statement?).</p>
  
  <p>I think I'm missing something here, is there a simple way to pass streams between objects cleanly, or do I need a different approach?</p>
  
  <p>Thanks in advance for any help!</p>