我只是尝试使用foursquare场所API解析json,并在我的windowphone应用程序的列表框中显示一些位置,但是当我运行这行代码时,我一直收到错误securityexception未处理。
var providerResult =(Venues.RootObject)dataContractJsonSerializer.ReadObject(stream);
in
private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) {
if (e.Error == null) {
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(e.Result))) {
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(Venues.RootObject));
var providerResult = (Venues.RootObject)dataContractJsonSerializer.ReadObject(stream);
if (providerResult == null) {
MessageBox.Show("No location were found");
}
else {
locations.ItemsSource = providerResult.response.venues;
}
}
}
else {
MessageBox.Show(e.Error.Message);
}
}