Deserialization backwards compatibility

前端 未结 5 1344
刺人心
刺人心 2020-12-05 15:08

I am trying to deserialize \"SomeClass\" with an older version of an application. I get this below exception

System.Runtime.Serialization.Serializatio

5条回答
  •  不思量自难忘°
    2020-12-05 15:43

    It seems that one way to do this would be to have a versioned object, that way you could try deserializing the object using the latest version. If that didn't work, step back a version until it's successful. Then once you have your object, update it to the latest version of the object and use default values for any fields you don't have data for.

提交回复
热议问题