title: A change to a field isn't being retained when using BinaryFormatter - why?
body: <p>I have two methods. One method will cause SignInStatus = true and other false. For some reason when I add in the binary writers and readers the SignInStatus is always false. I have a binary reader and writer method:</p>
  
  <pre><code>public static void WriteEmployeeDataBase()
  {
  
      FileStream filestreams = new FileStream(Convert.ToString(Settings.Default["Path"]) + "\\EmployeeDatabase.dat", FileMode.Create, FileAccess.ReadWrite,FileShare.ReadWrite);
     formatter.Serialize(filestreams, Employee.EmployeeDatabase);
  
  }
  
  public static void ReadEmployeeDataBase()
  {
  
      FileStream filestream = new FileStream(Convert.ToString(Settings.Default["Path"]) + "\\EmployeeDatabase.dat", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
      Employee.EmployeeDatabase = (List&lt;Employee&gt;)formatter.Deserialize(filestream);
  
      ...
  </code></pre>
  
  <p>Then I have two methods SignIn and Signout</p>
  
  <pre><code>public bool SignIn()
  {
      ReadEmployeeDataBase();
  
      if (this.SignInStatus == false)
      {
  
          this.SignInStatus = true;     
          WriteEmployeeDataBase();
      }
  
      ...
  }
  
  public bool SignOut()
  {
  
      ReadEmployeeDataBase();
  
      if (this.SignInStatus == true )
      {
  
  
          this.SignInStatus = false;
          WriteEmployeeDataBase();
      }
  }
  </code></pre>
  
  <p>Here is my class</p>
  
  <pre><code>[Serializable]   
  class Employee 
  {
      public bool SignInStatus { get; set; }  
  
      public static BinaryFormatter formatter = new BinaryFormatter()
  
      List&lt;Class&gt; mylist = new List&lt;Class&gt;;
  
      public Employee() { ... }
  
      ...
  }
  </code></pre>
  
  <p>Here is how I create the object:</p>
  
  <pre><code>public static CreateObject(string name)    
  {
  
      mylist.Add(new Object(name));
  
      ...
  </code></pre>