Click here to Skip to main content
15,569,696 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

XMLSerialize object will serialize the Private fields as well?

Thanks
Krishna
Posted

No. See here.

"Note: XML serialization does not convert methods, indexers, private fields, or read-only properties (except read-only collections). To serialize all an object's fields and properties, both public and private, use the BinaryFormatter instead of XML serialization."
 
Share this answer
 
No you cannot XML serialize private members.

Three rules when using XML serialization,
1) Class must be public
2) Serialized members must be public as well
3) and you should have a parameter-less Constructor
 
Share this answer
 
See this : http://stackoverflow.com/questions/802711/serializing-private-member-data[^]
Maybe that's your solution.

Cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900