Hi all,
i want to save my user name and password in xml Form for this i am using Serialization
my problem is there are also others property in my class but i want to serialized only this two property not whole class plz help me to serialize only these two property
Loading

SenthilkumarRank #387 · 6.5K reputationPosted Apr 27, 2012, 2:10 AM EDT
Sumit KumawatRank #4,008 · 372 reputationPosted Apr 27, 2012, 2:56 AM EDT
Thanx for ur Reply.
i have one more doubt..
XmlSerializer serializer = new XmlSerializer(typeof(LoginViewModel));
im using this code for serialization here im passing my class name where are my all properties which im serialized. can i pass direct property name instead of passing class name??
VulpesRank #55 · 29.2K reputationPosted Apr 27, 2012, 5:25 AM EDT
As Senthil said, you need to mark all those properties which you don't want serializing with the [XmlIgnore] attribute. The serializer will then only serialize the remainder.
When the object is deserialized, the properties which haven't been serialized will be set to their default values.
Veera Chenna26 reputationPosted Apr 27, 2012, 10:31 AM EDT
http://technico.qnownow.com/2012/04/26/xml-serialization-in-c/