I noticed that using RestSharp :Execute<T>()
, when T as below
public class Result
{
public List<DBData> Data { get; set; }
public int Total { get; set; }
public bool Success { get; set; }
}
It deserialized the JSON from Execute<Result>()
correctly into Result object,
However when the class has IEnumerable property like below
public class Result
{
public IEnumerable<DBData> Data { get; set; }
public int Total { get; set; }
public bool Success { get; set; }
}
Execute<Result>()
does not fill(deserialize) into the object Result.
I am suspecting it is because of IEnumerable<T>
being read only and Restsharp is unable to deserialize data because of that ? Is it the case ?
Because RestSharp can not infer the type of the property from the IEnumerable. Extend the existing SimpleJson serializer to use more robust serializer like Json.Net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With