title: Saving/Loading RichTextBox Content with other data using C#
body: <p>I am currently trying to figure out how to save the content from a RichTextbox into a stream(currently using FileStream) and do this alongside a bunch of other data. Then of course I want to be able to load from this file.
  I was currently trying to use something along the following lines.</p>
  
  <pre><code>FileStream stream = new FileStream(); //this is actually correctly defined.
  ASCIIEncoding encoding = new ASCIIEncoding();
  
  //write Title
  byte[] array = encoding.GetBytes(Title);
  stream.WriteByte(Convert.ToByte(array.Length));
  stream.Write(array, 0, array.Length);
  
  //save textRange
  textRange.Save(stream, System.Windows.DataFormats.Rtf);
  
  //write Subtitle
  byte[] array = encoding.GetBytes(Subtitle);
  stream.WriteByte(Convert.ToByte(array.Length));
  stream.Write(array, 0, array.Length);
  //ect...and something very similar for Loading a file.
  </code></pre>
  
  <p>This is basically what I am trying to do. I am actually saving 2 TextRanges and a bunch more Properties. So my problem is that TextRange.Load() reads to the end of the file...making it impossible for me to use that considering I have 2 TextRanges I need to save/load.
  So here I am trying to come up with another way to be able to save/load the content of a RichTextBox with other data. I dont have to use a Stream. I am pretty much open to any feasible solutions. Thanks in advance!</p>
  
  <p>~Jasson</p>