473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Deserialization of changed objects

Hi

Let's assume that I have an object_V1 (version 1) serialized to disk. Later,
the class for object_V1 will change to object_V2, having some more members.
Now, I would like to read my previously saved objects of type object_V1 into
object_V2, which (logically) now throws an exception.

I tried to make use of the HeaderHandler, but this gives me only access to
the methods, not the members. I also tried to inherit object_V1 into
object_V2, which didn't work either.

Is there an way to control this deserialization process, any samples around?

Any hints ar appreciated.

Thanks. Urs.
Nov 15 '05 #1
2 1549


"Urs Vogel" <ur******@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...

Is there an way to control this deserialization process, any samples around?


Hi Urs,

You'll need to implement ISerializable on the type you are serializing and
deserializing and control the versioning yourself.

Joe
--
http://www.csharp-station.com
Nov 15 '05 #2
you can deserialize the same object, if you changed the
object by adding a property, i am afraid you are going to
get a fresh and warm exception ... Lets wait and see if
some one tells otherwise ..

- Sarosh
-----Original Message-----
Hi

Let's assume that I have an object_V1 (version 1) serialized to disk. Later,the class for object_V1 will change to object_V2, having some more members.Now, I would like to read my previously saved objects of type object_V1 intoobject_V2, which (logically) now throws an exception.

I tried to make use of the HeaderHandler, but this gives me only access tothe methods, not the members. I also tried to inherit object_V1 intoobject_V2, which didn't work either.

Is there an way to control this deserialization process, any samples around?
Any hints ar appreciated.

Thanks. Urs.
.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Snowman | last post by:
Suppose I have a RootObject which holds a collection of other objects. The other objects have a property (Parent) which refers back to the "parent" collection (b.t.w. my collection is based on...
5
by: Urs Vogel | last post by:
Hi I'm wondering if there's a technique to deserialize objects which were serialized with an earlier version of the class. Example: // version 1 class { string myString; int ...
6
by: Nick Z. | last post by:
I need my program to start as fast as possible. Will deserialization a few settings using binary deserialization affect that? Or should I keep these settings in XML, will that be any better? ...
3
by: AnkitAsDeveloper [Ankit] | last post by:
Hi i am serializing a 'ref struct' object as follows : private: void Seri( String ^path, Object^ obj ) { FileStream^ fileStrm ; try { //Serialize entire object into Binary stream
3
by: Urs Vogel | last post by:
Hi Let's assume that I have an object_V1 (version 1) serialized to disk. Later, the class for object_V1 will change to object_V2, having some more members. Now, I would like to read my...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
1
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client...
5
by: Greg Allen | last post by:
I am consuming a web service and using the generated Reference.cs to access the service and the objects associated with it. I have run into a problem where some inherited classes are not being...
7
by: Andrew | last post by:
Hi, I am using DataContractJsonSerializer to deserialize JSON string in C# objects but I am having a problem. Suppose I have a class: class Item { public ItemId Id { get; set; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.