PC Review


Reply
Thread Tools Rate Thread

How to Deserialize to a specific object instance.

 
 
MP
Guest
Posts: n/a
 
      15th Feb 2005
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


 
Reply With Quote
 
 
 
 
Ollie Riches
Guest
Posts: n/a
 
      15th Feb 2005
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:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Peter Rilling
Guest
Posts: n/a
 
      15th Feb 2005
Why would you need it to be the same "instance"?

"MP" <martin.pare@I_Will_Not_Give_You_My_Address> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
MP
Guest
Posts: n/a
 
      15th Feb 2005
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" <(E-Mail Removed)> wrote in message
news:Ou$(E-Mail Removed)...
> 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:(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
Ollie Riches
Guest
Posts: n/a
 
      15th Feb 2005
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:#(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:Ou$(E-Mail Removed)...
> > 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:(E-Mail Removed)...
> >> 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
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
daiyue
Guest
Posts: n/a
 
      16th Feb 2005
I believe it's impossible to do so.
"MP" <martin.pare@I_Will_Not_Give_You_My_Address> 写入消息新闻:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
MP
Guest
Posts: n/a
 
      17th Feb 2005
Well.... I just figured it out. Now, I just need to get this working with
remoting.

-Martin
"daiyue" <(E-Mail Removed)> wrote in message
news:OQWX%(E-Mail Removed)...
>I believe it's impossible to do so.
> "MP" <martin.pare@I_Will_Not_Give_You_My_Address>
> 写入消息新闻:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
=?Utf-8?B?Sm9obiBSLg==?=
Guest
Posts: n/a
 
      29th Mar 2005
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" <(E-Mail Removed)> wrote in message
> news:OQWX%(E-Mail Removed)...
> >I believe it's impossible to do so.
> > "MP" <martin.pare@I_Will_Not_Give_You_My_Address>
> > 脨麓脠毛脧没脧垄脨脗脦脜:(E-Mail Removed)...
> >> 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
> >>

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deserialize object Peter K Microsoft C# .NET 2 26th Aug 2009 03:17 PM
Deserialize XML to an Object. BUT you don鈥檛 know which object to use? ink Microsoft C# .NET 6 1st Dec 2008 09:58 AM
Select and attach to specific COM EXE instance as COM object Jon Davis Microsoft C# .NET 9 14th Apr 2006 06:56 PM
Access specific instance of session object jw56578@gmail.com Microsoft ASP .NET 1 16th Aug 2005 01:33 AM
How to Deserialize to a specific object instance. MP Microsoft Dot NET Framework 7 29th Mar 2005 10:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 PM.