title: how can i write a byte array to a file using a SaveFileDialog?
body: <p>Basically I have have a program that creates an array of bytes (manually entered via a richtextbox and I want to be able to  create a new file and save the bytes in that file via a SaveFileDialog() method. </p>
  
  <p>The code I have come up with is: </p>
  
  <pre><code>byte[] bytes = Encoding.ASCII.GetBytes(richTextBox1.Text);
  Stream stream = new MemoryStream(bytes);
  
  SaveFileDialog file = new SaveFileDialog();
  file.ShowDialog();
  
       if (file.FileName != "")
       {
           using (BinaryWriter bw = new BinaryWriter(stream)) 
           {
               bw.Write(bytes); 
           }
  
  
       }
  </code></pre>