2 回答
TA贡献1827条经验 获得超4个赞
为了继续前进,我实施了以下解决方法:
public class PagedClientModelList<T> : List<T>
{
public PaginationMetadata PaginationMetadata { get; set; }
}
public class PaginationMetadata
{
public int TotalCount { get; set; }
public int PageSize { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
}
现在我可以毫无问题地反序列化:
var result = JsonConvert.DeserializeObject<PagedClientModelList<Person>>
(httpResponseMessage.Content.ReadAsStringAsync().Result);
if (httpResponseMessage.Headers.TryGetValues("X-Pagination", out var xPagination))
{
result.PaginationMetadata = JsonConvert.DeserializeObject<PaginationMetadata>(xPagination.First());
}
- 2 回答
- 0 关注
- 213 浏览
添加回答
举报