How to seralize only some properties in .Net?
Posted
by Beta033
on Stack Overflow
See other posts from Stack Overflow
or by Beta033
Published on 2010-03-15T22:46:19Z
Indexed on
2010/03/15
22:49 UTC
Read the original article
Hit count: 255
This is for a web project so i have several classes that inherit from Web.UI.
I only want to serialize very particular properties (basically, only local properties)
I'm aware of the XMLIgnore property that can be placed on a property to ignore items, but this won't work in my context since that would require modifying a bunch of stuff that i really don't want to modify (and probably can't).
So how do i tell the xml serializer to ignore everything except for X and Y or tell it to seralize just X and Y?
i could just create my own xml in a string builder or something and if that's the only way, so be it. however i'm looking for a method that will employ the built in XML stuff.
Thanks
© Stack Overflow or respective owner