alexcoco
alexcoco

Reputation: 6665

Saving Object to IsolatedStorage in WP7 with XNA 4.0

How can I go about saving an object of type GameSettings to IsolatedStorage on a Windows Phone 7 application made with XNA 4.0?

From what I can tell, you can't flag a class as serializable and ByteFormatter isn't available. I haven't come across a good way to convert an object to a byte array and write the array to the storage. And going beyond that, I have no idea how to go about converting said byte array back into an object.

Any help would be greatly appreciated!

Upvotes: 1

Views: 954

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65566

There is no built in binary formatter on the platform but it does support XML and JSON serialization using the DataContractSerializer and DataContractJsonSerializer classes.

You can configure what is serialized via the DataContract and DataMember attributes.

Upvotes: 1

Related Questions