Compare Serialized object

  • Thread starter Thread starter Paez
  • Start date Start date
P

Paez

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
 
Paez said:
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.
 
Back
Top