title: Serialization and versioning
body: <p>I need to serialize some data to string. The string is then stored in DB in a special column SerializeData. </p>
  
  <p>I have created special classes that are used for serialization.</p>
  
  <pre><code>[Serializable]
  public class SerializableContingentOrder
  {
      public Guid SomeGuidData { get; set; }
      public decimal SomeDecimalData { get; set; }
      public MyEnumerationType1 EnumData1 { get; set; }
  }
  </code></pre>
  
  <p>Serialization:</p>
  
  <pre><code>protected override string Serialize()
  {
      SerializableContingentOrder sco = new SerializableContingentOrder(this);
  
      MemoryStream ms = new MemoryStream();
      SoapFormatter sf = new SoapFormatter();
      sf.Serialize(ms, sco);
      string data = Convert.ToBase64String(ms.ToArray());
      ms.Close();
      return data;
  }
  </code></pre>
  
  <p>Deserialization:</p>
  
  <pre><code>protected override bool Deserialize(string data)
  {
      MemoryStream ms = new MemoryStream(Convert.FromBase64String(data).ToArray());
      SoapFormatter sf = new SoapFormatter();
  
      SerializableContingentOrder sco = sf.Deserialize(ms) as SerializableContingentOrder;
      ms.Close();
      return true;
  }
  </code></pre>
  
  <p>Now I want to have versioning support. What happens if I change <code>SerializableContingentOrder</code> class. I want to be able to add new fields in the future.</p>
  
  <p>Do I have to switch to DataContract serialization? Please give me short snippet?</p>