简体   繁体   中英

serializing class to file in silverlight

I have made a Silverlight app that contain a class and I want to serialize that class to some binaryfile of XML file , Is that possible in silverlight or not? without using WCF service,and how can i do it.?

You cannot write to files with Silverlight. You cannot access the client filesystem for obvious security reasons. If you need some storage on the client you could use the Isolated Storage . And for serializing a class to an XML string or a Stream you could use for example the XmlSerializer class.

Take a look at this video. It will help with how to access the local FS. I would assume the XML serializer is available for Silverlight but I am not certain.

http://www.silverlight.net/learn/graphics/file-and-local-data/local-file-access For writing to isolatedstorage see this: http://programming4.us/multimedia/882.aspx

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