c# - XML Serialization of Private Variables -
I am new to XML serialization and I have read that the While debugging I have made my object after deserialization Immediately see, I find the variable Private variable right now Will also be present in the deserialized object, but their values will not be stored in the XML serialized version. To display this, if you make an example of your object, then private variables are not ordered yet As long as they are given under a public property but after deserializing I am able to find private variables in the deserialized object while debugging. Can anyone explain this? Here is my code:
class program {static wide men (string [] arg) {XmlSerializer xs = new XML serializer (typef (Nokia)); Nokia N = New Nokia (); (Stream s = new file stream ("XMLFile", FileMode.Create, FileAccess.Write, FileShare.None) {xs.Serialize (s, n); } XmlSerializer xs1 = New XmlSerializer (type (Nokia)); (Stream ds = file using OpenRide ("XMLFile")) (Nokia DN = (Nokia) xs1. Direialize (DS);}}} Public class mobile {public perfection = 10; personal full weight = 20 ; Public Mobile () {}} Public class Nokia: Mobile {public string signal = "bad"; public Nokia () {}}
weight in the base I am able to do this. How is this possible? Or am I wrong somewhere else?
weight Change the value to serialize the XML. If you do this, you can deserialized the object The
weight will default value instead of setting the value of the original object.
Comments
Post a Comment