【发布时间】:2012-10-01 08:40:12
【问题描述】:
我正在尝试在我的 Windows Phone 应用程序中下载 JSON,然后对其进行解析。通过互联网搜索,我发现上面的代码应该可以正常工作:
using (WebClient wc = new WebClient())
{
string result = wc.DownloadString("http://data.nature.com/sparql");
}
但在我的 Windows Phone 应用程序中,我无法将 wc.DownloadStringAsync() 分配给字符串类型变量。
我的代码:
WebClient webClient = new WebClient();
webClient.DownloadStringAsync(new Uri("http://184.22.234.221/bfunction/mjson.php"));
var container = DeserializeFromJson<DataJsonAttributeContainer>(JsonStr);
这里,JsonStr 是我要分配下载的 JSON 数据的字符串。我该怎么做?
【问题讨论】:
标签: c# json windows-phone-7 webclient json.net