I’ve got WCF service which contains List with data from LibW.dll(my dll). In main program I also have got list from LibW.dll.
I return list from WCF service
[OperationContract]
public List<IWeather> Final()
{
return returner;
}
and then try to set the result of method to value
cont = e.Result;
where
List<LibW.IWeather> cont=new List<LibW.IWeather>();
But I’ve got such error
Cannot implicitly convert type System.Collections.ObjectModel.ObservableCollection<object>' to 'System.Collections.Generic.List<NavigationGadget.IWeather>
What’s wrong?
Presumably
e.Resultis anObservableCollection<T>then… even if you’ve declared it as aList<IWeather>in your service.It looks like you also need to cast from
objecttoIWeather– assuming each result really is anIWeather. You could always copy it to a list, like this:… or change your variable type so it can handle any
IList<IWeather>.