While trying to call a WCF service and assigning a resultant array to a local variable, you may encounter an compile error 'Cannot implicitly convert type 'System.Collections.ObjectModel.ObservableCollection'.
How to resolve this error.
below might be code you might be trying to compile
void proxy_GetUOSListCompleted(object sender, SilverScreens.SilverServiceProxy.GetUOSListCompletedEventArgs e)
{
//Here result returns a List object
SilverServiceProxy.UOS[] ResultUOS = e.Result;
UOSList.ItemsSource = ResultUOS;
}
Following are the steps to resolve it.
Right click on Service Reference in your Webapplication. In the context menu select "Configure Service Reference...", choose in the combobox of collection type: System.Array.
The other work around is to change the code to use ObservableCollection collection, since ObservableCollection also implements suitable property changed notification mechanism such as the INotifyPropertyChanged interface
void proxy_GetUOSListCompleted(object sender, SilverScreens.SilverServiceProxy.GetUOSListCompletedEventArgs e)
{
//Here result returns a List object
List&;
1 comment:
saved my life..thanks
Post a Comment