I am trying to deserialize this to an c# object using restsharp
Before marking as a duplicate question note that I have looked at the following stack overflow questions and it has not worked
The response:
<response>
<TAG>
<tagid>1</tagid>
<mac>00:12:8E:12:2F:34</mac>
</TAG>
<TAG>
<tagid>2</tagid>
<mac>00:11:8E:12:3F:11</mac>
</TAG>
</response>
My Class that I hoped to use but is only it states count =0...
public class Response
{
public Response()
{
this.Tag = new List<Tag>();
}
[XmlElement()]
public List<Tag> Tag { get; set; }
}
public class Tag
{
public string Tagid { get; set; }
public string Mac { get; set; }
}
The code that tries to deserialize
var request = new RestRequest
{
Resource = "api/notimportant",
RequestFormat = DataFormat.Xml,
Method = Method.GET,
};
request.AddParameter("fields", "all");
var client = new RestClient
{
BaseUrl = new Uri(_url),
};
client.AddHandler("application/xml", new DotNetXmlDeserializer());
var response = client.Execute<Response>(request);
My many test
If I used response I get nothing but when I used tag I get only the first element instead of list which I what I want...