如何从窗口电话中的Webservice获取List?

时间:2014-04-20 09:03:23

标签: c# xml linq list service

我有一个代码:

List<Songs> song;
ServiceBaiHat.MywebserviceSoapClient service = new ServiceBaiHat.MywebserviceSoapClient(); 
service.getListCatalogAsync();

service.getListCatalogCompleted+=service_getListCatalogCompleted;


private void service_getListCatalogCompleted(object sender, ServiceBaiHat.getListCatalogCompletedEventArgs e)
{
  if (e.Result != null)
  {
    XElement element = XElement.Parse(e.Result.ToString());
    listbaihat = (from p in element.Descendants("songs")
                  select new Songs
                  {
                    name = (string)p.Element("name"),
                    link = (string)p.Element("link"),
                    album = (string)p.Element("album")
                  }).ToList<Songs>();

  }
}

现在,为什么在element.Descendants(&#34;歌曲&#34;)上有错误???

0 个答案:

没有答案