我不明白为什么我会收到以下错误:
'System.Collections.Generic.List Notify.MainPage.webClient_OpenReadCompleted(object, System.Net.OpenReadCompletedEventArgs)' 的返回类型错误
代码:
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
和:
private List<SightingType> webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
DataContractJsonSerializer ser = null;
var sightingT = new List<SightingType>();
try
{
ser = new DataContractJsonSerializer(typeof(ObservableCollection<SightingType>));
ObservableCollection<SightingType> sightingTypes = ser.ReadObject(e.Result) as ObservableCollection<SightingType>;
foreach (var sightingType in sightingTypes)
{
sightingT.Add(sightingType);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return sightingT;
}
有谁知道我哪里出错了?