我只是尝试使用foursquare场地API解析json并在我的windowphone应用程序的列表框中显示某些位置,但是当我运行这行代码时,我不断收到错误securityexception is unhandled。
var providerResult = (Venues.RootObject)dataContractJsonSerializer.ReadObject(stream);
在
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);
}
}