I don’t know how to represent some XML as a C# class. Does anyone have any suggestions as to how to properly map this xml? Here’s my attempt below:
<authenticationResponse>
<Accounts>
<AccountId>1</AccountId>
<AccountId>5</AccountId>
</Accounts>
</authenticationResponse>
public class authenticationResponse
{
[XmlElement("Accounts")]
[DataMember]
public List<Account> Accounts { get; set; }
}
public class Account
{
public long id { get; set; }
}
You may load this data via LINQ to XML:
In this case
authenticationResponseclass is redundant.If you’ve got the response in memory (not in a file on your harddrive), you may use this: