简体   繁体   中英

Do I need to serialize an object for storing it or without serialization it can be stored in C#.Net using WP 7.1 SDK?

I want to store custom objects in isolatedstoragesettings of WP7.1 application. My program works well if I hard-code it. But without hard-coding it gives exception on Save() method of isolatedstoragesettings class.

Exception is:

Type 'PhoneApp4.Classes.Objects.Person' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

Please Provide some sample code or suggestion to begin, because I am new to windows phone.

Yes, you should make it serializable. Check out this article: http://www.codeproject.com/Articles/268151/XML-Serialization-in-Windows-Phone-7-Tips-and-Tric

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM