I am trying to serialize part of a class from a C # model to an XML file. However, I would like to do this with less code.
I currently have this: a class with many properties (some of them are annotated using [XmlIgnore]) for serialization
public class MyClass
{
public int id {get;set;}
public string Title {get;set;}
public string Body {get;set;}
[XmlIgnore]
public byte[] Image {get;set;}
...
}
a template that must fit
<Properties>
<Property Name="id">Value</Property>
<Property Name="Title">Value</Property>
<Property Name="Body">Value</Property>
...
</Properties>
The name is a property in my C # model
The only thing I have found so far requires me to create another class for this, and I do not want to separate my model in different subclasses. Do you know a way (possibly with annotations) to create serialization for it?
source
share