title: Writing data from a structure to a file in c#
body: <p>So I am currently attempting to write data from a structure to a binary file and am not having a ton of luck, I was just wondering if anyone could point me in the right direction of what I may need to implement as most of what I've tried and researched has been unsuccessful. Below is very basic skeleton code attempting to demonstrate my issue. </p>
  
  <p>Thanks!    </p>
  
  <pre><code>public struct TSensor
  {
      byte b1;
      int i1;
      float f1;
  }
  
  class Program
  {
      const string fileName = "AppSettings.bin";
  
      static void Main()
      {
          using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
          {
              writer.Write();
          }
      }
  }
  </code></pre>