将system.collection.objectmodel.observation转换为通用列表时无法分配值和错误

时间:2014-06-02 06:34:41

标签: c# wcf

proxy.loginCompleted += new EventHandler<loginCompletedEventArgs>(loginfn);
proxy.loginAsync(username,password1);
void loginfn(object sender, loginCompletedEventArgs e)
{
    if (e.Result.Count!=0)
    {
        System.Collections.ObjectModel.ObservableCollection<customer> temp = e.Result;
        foreach (var item in temp)
        {
           Guid companyrefid = item.companyrefid;
           int id = item.id;
        }
        NavigationService.Navigate(new Uri("/customernames.xaml", UriKind.Relative));
    }
}

在wcf中:

public List<customer> login(string salesmanname, string usercode)//i am getting values in this 

1 个答案:

答案 0 :(得分:0)

您可以通过这种方式从ObservableCollection<T>初始化List<T>

ObservableCollection<customer> temp = new ObservableCollection<customer>(e.Result);