title: Writing string and bytes to the same FileStream
body: <p>I need to create a file where some parts are strings (utf-8), while some parts are bytes.</p>
  
  <p>I tinkered for hours with <code>StreamWriter</code> and <code>BinaryWriter</code>, but this is the only thing that works:</p>
  
  <pre><code>        using (var stream = new FileStream(_caminho, FileMode.Create, FileAccess.Write))
          {
              using (var writer = new StreamWriter(stream))
              {
                  writer.Write(myString);
              }   
          }
          using (var stream = new FileStream(_caminho, FileMode.Append, FileAccess.Write))
          {
              using (var writer = new BinaryWriter(stream))
              {
                  writer.Write(oneSingleByte);
              }
          }
  </code></pre>
  
  <p>The problem is that I have to close the FileStream and open another one just to write a single byte, because either the <code>BinaryStream.Write(string)</code> method prepends a "length" field (undesired in my case) or the <code>StreamWriter.Write(byte)</code> encodes the byte value instead of actually writing directly.</p>
  
  <p>My question is: is there another class I can use so that I can create the FileStream only once, and write my string and my byte one after another?</p>