title: How do I force write to file using StreamWriter?
body: <p>I always use <code>streamwriter writer = new StreamWriter(file)</code> to write to file. The problem is it wont actually write to file until <code>writer.close()</code>. </p>
  
  <p>If between class create and class close something bad happens (and the program never reaches writer close),  I wont get any information in the file. How to force write between create and close?</p>