I'm trying to serialize a part of a class from a C# Model to a XML File. However i'd like to do it with the less possible amount of code.
I currently have this : a class with a lot of properties (some of them are annotated with [XmlIgnore]) to serialize
public class MyClass
{
public int id {get;set;}
public string Title {get;set;}
public string Body {get;set;}
[XmlIgnore]
public byte[] Image {get;set;}
...
}
the pattern i need to match
<Properties>
<Property Name="id">Value</Property>
<Property Name="Title">Value</Property>
<Property Name="Body">Value</Property>
...
</Properties>
the Name is the property in my c# model
The only things i found so far needs me to create a different class for that, and i don' t want to split my model in different sub classes. Do you know a way (Maybe with annotations) to create a custom serialization for this ?