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
Veera ChennaPosted Apr 27, 2012, 2:31 PM
http://technico.qnownow.com/2012/04/26/xml-serialization-in-c/
VulpesPosted Apr 27, 2012, 9:25 AM
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.
Sumit KumawatPosted Apr 27, 2012, 6:56 AM
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??
SenthilkumarPosted Apr 27, 2012, 6:10 AM