473,320 Members | 1,865 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,320 software developers and data experts.

How to Deserialize to a specific object instance.

MP
Hi,
I would like to be able to deserialize a stream to a specific instance.
Deserialize returns me a new instances and that is not really what we need,
we need to deserialized to an existing instance. Can anyone point me in the
rigth direction?
Regards

-Martin
Nov 16 '05 #1
7 2084
when deserialize(re-hydrate) an object from an XML stream it creates a new
instance of the type so therefore it will have a completely different hash
code (GetHashCode()). If you want to map this onto an already existing
instance of the type you will have to do this after the deserialization has
been compeleted.

HTH
Ollie Riches
"MP" <martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Hi,
I would like to be able to deserialize a stream to a specific instance. Deserialize returns me a new instances and that is not really what we need, we need to deserialized to an existing instance. Can anyone point me in the rigth direction?
Regards

-Martin

Nov 16 '05 #2
Why would you need it to be the same "instance"?

"MP" <martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Hi,
I would like to be able to deserialize a stream to a specific instance. Deserialize returns me a new instances and that is not really what we need, we need to deserialized to an existing instance. Can anyone point me in the rigth direction?
Regards

-Martin

Nov 16 '05 #3
MP
Thank you Ollie,
Then the obvious question is: Is there a simple way map one instance of
an object onto another? Kind of a copy operator....

Thank you again.

-Martin

"Ollie Riches" <ol**********@hotmail.com> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl...
when deserialize(re-hydrate) an object from an XML stream it creates a new
instance of the type so therefore it will have a completely different hash
code (GetHashCode()). If you want to map this onto an already existing
instance of the type you will have to do this after the deserialization
has
been compeleted.

HTH
Ollie Riches
"MP" <martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Hi,
I would like to be able to deserialize a stream to a specific

instance.
Deserialize returns me a new instances and that is not really what we

need,
we need to deserialized to an existing instance. Can anyone point me in

the
rigth direction?
Regards

-Martin


Nov 16 '05 #4
MS have created an interface in the .Net framework called 'ICloneable' that
is a pattern for copying an instance of a class and returing the new
instance.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemicloneableclasstopic.asp

HTH

Ollie Riches

All you have to do is impletm "MP"
<martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:#O**************@tk2msftngp13.phx.gbl...
Thank you Ollie,
Then the obvious question is: Is there a simple way map one instance of an object onto another? Kind of a copy operator....

Thank you again.

-Martin

"Ollie Riches" <ol**********@hotmail.com> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl...
when deserialize(re-hydrate) an object from an XML stream it creates a new instance of the type so therefore it will have a completely different hash code (GetHashCode()). If you want to map this onto an already existing
instance of the type you will have to do this after the deserialization
has
been compeleted.

HTH
Ollie Riches
"MP" <martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Hi,
I would like to be able to deserialize a stream to a specific

instance.
Deserialize returns me a new instances and that is not really what we

need,
we need to deserialized to an existing instance. Can anyone point me in

the
rigth direction?
Regards

-Martin



Nov 16 '05 #5
I believe it's impossible to do so.
"MP" <martin.pare@I_Will_Not_Give_You_My_Address> 写入消息新闻:uc**************@TK2MSFTNGP14.phx.gbl ...
Hi,
I would like to be able to deserialize a stream to a specific instance.
Deserialize returns me a new instances and that is not really what we
need, we need to deserialized to an existing instance. Can anyone point me
in the rigth direction?
Regards

-Martin

Nov 16 '05 #6
MP
Well.... I just figured it out. Now, I just need to get this working with
remoting.

-Martin
"daiyue" <my******@gmail.com> wrote in message
news:OQ****************@tk2msftngp13.phx.gbl...
I believe it's impossible to do so.
"MP" <martin.pare@I_Will_Not_Give_You_My_Address>
写入消息新闻:uc**************@TK2MSFTNGP14.phx.gbl ...
Hi,
I would like to be able to deserialize a stream to a specific
instance. Deserialize returns me a new instances and that is not really
what we need, we need to deserialized to an existing instance. Can anyone
point me in the rigth direction?
Regards

-Martin


Nov 16 '05 #7
MP,

How did you do it? I need to do the same thing.

Thanks,

John

---------------
"MP" wrote:
Well.... I just figured it out. Now, I just need to get this working with
remoting.

-Martin
"daiyue" <my******@gmail.com> wrote in message
news:OQ****************@tk2msftngp13.phx.gbl...
I believe it's impossible to do so.
"MP" <martin.pare@I_Will_Not_Give_You_My_Address>
脨麓脠毛脧没脧垄脨脗脦脜:uc**************@TK2MSFTN GP14.phx.gbl...
Hi,
I would like to be able to deserialize a stream to a specific
instance. Deserialize returns me a new instances and that is not really
what we need, we need to deserialized to an existing instance. Can anyone
point me in the rigth direction?
Regards

-Martin



Nov 17 '05 #8

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

Similar topics

7
by: Ian Tompsett | last post by:
H I was wondering if it possible for an object to serialize/deserialize itself from XML. I'd be guessing that it would need to use the XmlSerializer class, but that seems to want to create a...
4
by: George Addison | last post by:
I understand this might not be the optimal method of deserialization, but how can I deserialize a class to itself? Something like: Public Sub New(Optional ByVal filename as string = Nothing)...
0
by: Matt S | last post by:
Hello, I'm trying to build a C# client to consume an AXIS Web Service (running SOAP over HTTP). The Web Service encodes full server-side exception traces in the Soap Fault > Detail element...
3
by: Jeff Richardson | last post by:
This is a repost from the InfoPath news group. Hi, I am writing a SharePoint application that works with InfoPath forms. When a user submits a completed InfoPath form to a forms library my code...
1
by: Sriranjan | last post by:
Hi, How do I deserialize an object based on a random XML file? I have tried using the XMLSerializer.Deserialize method but it does not set the values for the members. I need tto do this...
2
by: Thomas S | last post by:
Any suggestions on how to deserialize an object from one line of XML? I'm trying to deserialize multiple objects from one XML document, each object on one line of the file. The serialization is...
2
by: Lambuz | last post by:
Hi all, I'm triying to create a prototype of a smart client that using .NET Remoting. I've got an assembly loaded into an HTML page by a tag object <OBJECT id="myID" height="150" width="300"...
11
by: wpmccormick | last post by:
I've a complex problem: I'm deserializing a very long string of XML into a very large object foo: <foo> ....... <bar>sometimes a simple string is here</bar> ....... </foo>
1
by: Hoss | last post by:
Quick Remark. I have a class that looks like this public Class { public int Attribu
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you抣l learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.