Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Denote properties of class to not be serialized

I'm using silverlight on WP7. I have a class I am trying to serialize to isolatedstorage. I know the framework will take care of serializing the class automatically for me, assuming every property is serializable.

For this class, I have some properties (such as BitmapImage) that are not serializable. Is there a way to tell the framework to NOT serialize that property (and instead, set it as null when it deserializes it?)

I know implementing XmlSerializable is a possibility, but I don't want to have to set/get each manually. I'd rather it serialize what I tell it to, and I can go and set the other properties after it has deserialized.

thanks

like image 759
Steve Avatar asked May 30 '11 03:05

Steve


1 Answers

You can use XmlIgnoreAttribute to tell XmlSerializer to ignore your property.

like image 123
Alex Aza Avatar answered Sep 25 '22 15:09

Alex Aza