Rafactoring vs. serialization

J

Jesper, Denmark

Hi,

I serialize data using a binary formatter. However, If I need to rename the
field of one of the serialized data, I cannot reload the file - reflection is
causing this I'm sure. However, is there a way to rename data within a binary
serialized file.

regards JEsper
 
M

Marc Gravell

I suspect you'd need to use a "serialization surrogate", which is a
lot of work. Note that serializers like DataContractSerializer,
XmlSerializer, etc allow you to control serialization names separately
- so you can have:

[DataMember("bar")]
private string foo;

in terms of serialization, it is called "bar", but you can re-factor
the code to "foo"...

Some other 3rd-party serializers (like protobuf-net) don't use names
at all.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top