Prev: Get file size via WebRequest
Next: CLR Debugger
From: Bob on 18 May 2010 08:28 I was using standard binary serialization to file for saving off collections of objects. I changed the structure of the objects slightly, fully expecting this to generate an exception on an attempt to load an older serialized image. Not so! It actually seemed to load all the fields with matching names. Is this normally the case? I'd expect that with serialization to an XML file, but not with binary.
From: Arne Vajhøj on 18 May 2010 20:31 On 18-05-2010 08:28, Bob wrote: > I was using standard binary serialization to file for saving off > collections of objects. I changed the structure of the objects > slightly, fully expecting this to generate an exception on an attempt > to load an older serialized image. Not so! It actually seemed to load > all the fields with matching names. > > Is this normally the case? I'd expect that with serialization to an > XML file, but not with binary. I have read that it can handle extra fields by just giving them default value but missing fields will make it barf. Should be easy to test. XML serialization and binary serialization are completely different. Arne
From: Bob on 20 May 2010 15:53 On Tue, 18 May 2010 20:31:14 -0400, Arne Vajh�j <arne(a)vajhoej.dk> wrote: >On 18-05-2010 08:28, Bob wrote: >> I was using standard binary serialization to file for saving off >> collections of objects. I changed the structure of the objects >> slightly, fully expecting this to generate an exception on an attempt >> to load an older serialized image. Not so! It actually seemed to load >> all the fields with matching names. >> >> Is this normally the case? I'd expect that with serialization to an >> XML file, but not with binary. > >I have read that it can handle extra fields by just giving them >default value but missing fields will make it barf. > >Should be easy to test. > >XML serialization and binary serialization are completely >different. > >Arne I expected your scenario above as best case. But I renamed a variable and the deserializer didn't crash. It didn't load the variable, of course, but it seemed to find all the others just fine, and ignored the one it couldn't find. That's behavior I would have expected from the XML serializer, but not binary. I wonder if this is documented somewhere.
|
Pages: 1 Prev: Get file size via WebRequest Next: CLR Debugger |