title: Write to file with FileStream without using "using"
body: <p>I have a class member variable <code>_stream</code> which is a <code>FileStream</code>. This variable gets initialized in the constructor and needs to stick around until I'm done with the class. I have another class that raises an event every time something needs to be written to the file. In my main class I have an event handler that performs the actual writing. I tried the following code as in <a href="https://stackoverflow.com/questions/14657643/writing-to-txt-file-with-streamwriter-and-filestream">this question</a>:</p>
  
  <pre><code>void MyEventHandler(string message)
  {
      using (_stream)
          using (StreamWriter s = new StreamWriter(_stream))
             s.WriteLine(message);
  }
  </code></pre>
  
  <p>But this doesn't work because <code>using</code> disposes of my <code>FileStream</code> before I'm done with it. What should I be doing instead?</p>