Customize your .NET object XML serialization with .NET XML attributes

יום ראשון, יולי 27, 2008

Hi, Serialize .net object to XML is very simple operation but let's say you want to control on the serialization and decide on the name of the XML attributes and elements that .net serialization create for your object. Well this is very simple to achive using built-in XML attributes (attributes like: XmlType, XmlAttribute, XmlArray, XmlArrayItem and more...) .NET gives us. The code example include 3 classes: MainStory, Story and BaseStory. MainStory and Story both inherits from BaseStory, MainStory also contain list (List<Story>) of stories objects. BaseStory: public class BaseStory {     protected const string DescriptionContentDelimiter = ":::";           public string Content { get; set; }           public...