Comment sérialiser un POCO avec les noms de propriétés souhaitées
Question
Cela devrait être simple, mais il me manque clairement l'astuce. J'ai un POCO:
public class job
{
public string title { get; set; }
public string company { get; set; }
public string companywebsite { get; set; }
public string[] locations { get; set; }
}
Je le sérialise à XML avec Restharp. J'espère obtenir soit:
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>New York</locations>
<locations>Los Angeles</locations>
<locations>Detroit</locations>
</job>
Ou idéalement ...
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>
<location>New York</location>
<location>Los Angeles</location>
<location>Detroit</location>
</locations>
</job>
Mais plutôt je comprends:
<job>
<title>Hello title</title>
<company>Hello company</company>
<locations>
<String />
<String />
<String />
</locations>
</job>
De toute évidence, le POCO doit être différent. Que puis-je faire?
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow