Domanda

Questo dovrebbe essere semplice, ma chiaramente mi manca il trucco. Ho 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; }
}

Lo sto serializzando in XML con RestSharp. Spero di ottenere entrambi:

<job>
    <title>Hello title</title>
    <company>Hello company</company>
    <locations>New York</locations>
    <locations>Los Angeles</locations>
    <locations>Detroit</locations>
</job>

O idealmente ...

<job>
    <title>Hello title</title>
    <company>Hello company</company>
    <locations>
         <location>New York</location>
         <location>Los Angeles</location>
         <location>Detroit</location>
    </locations>
</job>

Ma invece sto ottenendo questo:

<job>
    <title>Hello title</title>
    <company>Hello company</company>
    <locations>
         <String />
         <String />
         <String />
    </locations>
</job>

Chiaramente il Poco deve essere diverso. Cosa posso fare?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top