How to serialize a POCO with desired property names
Frage
This should be simple, but clearly I am missing the trick. I have a POCO:
public class job
{
public string title { get; set; }
public string company { get; set; }
public string companywebsite { get; set; }
public string[] locations { get; set; }
}
I am serializing it to XML with RestSharp. I am hoping to get either:
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>New York</locations>
<locations>Los Angeles</locations>
<locations>Detroit</locations>
</job>
Or ideally...
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>
<location>New York</location>
<location>Los Angeles</location>
<location>Detroit</location>
</locations>
</job>
But instead am getting this:
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>
<String />
<String />
<String />
</locations>
</job>
Clearly the POCO needs to be different. What can I do?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow