PC Review


Reply
Thread Tools Rate Thread

Compare Serialized object

 
 
Paez
Guest
Posts: n/a
 
      30th Dec 2006
Hello There.

I hava a Myclass [] obj1 in wich I add my computer hardware configuration.
After this object is "filled", I serialize it, into a dat file.

Then I deserialize it into obj2 and I compare the original and the
deserialized object, and they do not match! They sould match, I think. I use
obj1.Equals(obj2).

The goal is to find hardware changes when the computer starts.

Any help would be apreciated.

Paez


 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      30th Dec 2006

Paez wrote:
> Hello There.
>
> I hava a Myclass [] obj1 in wich I add my computer hardware configuration.
> After this object is "filled", I serialize it, into a dat file.
>
> Then I deserialize it into obj2 and I compare the original and the
> deserialized object, and they do not match! They sould match, I think. I use
> obj1.Equals(obj2).
>
> The goal is to find hardware changes when the computer starts.
>
> Any help would be apreciated.
>
> Paez


No, they won't match unless you overload the Equals method. The
default Equals method compares the object references. Deserializing an
object creates a new instance of the object, so the references no
longer compare as equal.

--
Tom Shelton

 
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
can every object be serialized even with referenced object within in a complex scenario Tony Johansson Microsoft C# .NET 2 5th Mar 2010 04:27 PM
open .net 2.0 serialized object with .net 1.1 Dennis C. Drumm Microsoft C# .NET 2 29th Nov 2005 12:01 PM
Serialized object to XmlDocument Pierre Microsoft C# .NET 6 13th Jul 2005 03:07 PM
deserialize an object serialized in c Christopher Dedels Microsoft Dot NET 1 13th Oct 2004 01:59 AM
xml serialized object in viewstate Sarfraz Hooda Microsoft Dot NET 0 20th May 2004 09:44 PM


Features
 

Advertising
 

Newsgroups
 


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