title: How do I save a stream to a file in C#?
body: <p>I have a <code>StreamReader</code> object that I initialized with a stream, now I want to save this stream to disk (the stream may be a <code>.gif</code> or <code>.jpg</code> or <code>.pdf</code>).</p>
  
  <p>Existing Code:</p>
  
  <pre><code>StreamReader sr = new StreamReader(myOtherObject.InputStream);
  </code></pre>
  
  <ol>
  <li>I need to save this to disk (I have the filename).</li>
  <li>In the future I may want to store this to SQL Server.</li>
  </ol>
  
  <p>I have the encoding type also, which I will need if I store it to SQL Server, correct?</p>