Best practice to serialize and deserialize .net objects across versions

后端 未结 4 1618
南旧
南旧 2021-02-10 02:55

Objects are serialized to a database using the .NET XML serializer. The object can change over time, and therefore multiple versions exist in the database at one time.

A

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-10 03:19

    Don't remove/rename properties. Only add them.

    Assign default values to all properties.

    This will guarantee that xml serializer will be able to deserialize old xml into new object, and that object will have "sane" values.

提交回复
热议问题