I don't understand why I am getting an error of:
'System.Collections.Generic.List Notify.MainPage.webClient_OpenReadCompleted(object, System.Net.OpenReadCompletedEventArgs)' has the wrong return type
Code:
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
And:
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;
}
Does anyone know where I am going wrong?
The return type of an event handler should be void:
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
There's nothing at the other end to receive the return data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With