解析 Xamarin 表单中的数据 [英] Parsing Data in Xamarin Forms

查看:14
本文介绍了解析 Xamarin 表单中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取集合 href(CustomerDemographics、Customers、Employees、Order Details) 中的名称来填充列表视图.我想知道如何在 Xamarin 平台或 C# 中解析这些信息.我对这个环境很陌生.我有过使用objective c在原生ios中解析json数据的经验,但还是第一次看到这种类型的数据.

I would like to get the names in collection href(CustomerDemographics, Customers, Employees, Order Details) to populate a listview. I would like to know how to parse these information in Xamarin platform or C#. I am quite new on this environment. I have experience how to parse json data in native ios with objective c, but it is the first time I see this type of data.

推荐答案

从附加的图像看来,您正在请求 OData 服务的服务文档.即服务的 http://host/service/ 端点.如果您想获取集合的内容,您应该将集合的名称附加到服务文档 URL 的末尾,例如:

From the attached image it seems that you're requesting the service document of the OData service. Namely the http://host/service/ endpoint of the service. If you would like to get the content of the collections, you should append the names of the collections to the end of the service document URL, such as:

GET http://host/service/Categories
GET http://hsot/service/CustomerDemographics

响应负载的格式取决于 OData 服务的协议版本.如果您正在与 OData V4 服务交谈(实际上看起来很像您在查询 Northwind OData V4 示例服务:http://services.odata.org/v4/northwind/northwind.svc/),响应负载将采用 JSON 格式,您可以使用您熟悉的方式解析响应.

The format of the response payload depends on the protocol version of the OData service. If you are talking to a OData V4 service (it actually seems a lot like you are querying the Northwind OData V4 sample service: http://services.odata.org/v4/northwind/northwind.svc/), the response payload will be in JSON format and you can use the ways that you are familiar with to parse the response.

此外,我建议您阅读 OData.org 上的基本教程,以便更好地掌握 OData 请求:http://www.odata.org/getting-started/basic-tutorial/

In addition, I would recommend you go through the basic tutorial on OData.org so that you can get a better grasp of OData requests: http://www.odata.org/getting-started/basic-tutorial/

这篇关于解析 Xamarin 表单中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆