无法分配给getfeed,因为它是方法组 [英] cannot assign to getfeeds since it is amethod group
本文介绍了无法分配给getfeed,因为它是方法组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试调用Web服务时,就像上面的错误一样,我想将返回结果odf Web服务另存为xml在本地系统中.我的代码是-
我的网络服务调用代码为:
When I am trying to call the webservice,it is saying like the above error, I want to save the return result odf webservice as xml in local system. My codes are -
My webservice calling code is:
DataSet ds = new DataSet();
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WpfApplication4.ServiceReference1.Service1SoapClient proxy = new WpfApplication4.ServiceReference1.Service1SoapClient ();
proxy.getfeeds=ds;
ds.WriteXml(@"D:\satish\sab.xml", XmlWriteMode.WriteSchema);
我的网络服务代码是:
My webservice code is:
[WebMethod]
public List<feeds> getfeeds()
{
List<feeds> feed = new List<feeds>();
DataSet ds = new DataSet();
ds.ReadXml(@"D:\satish1\na.xml");
var query= from item in ds.Tables[2].AsEnumerable()
select new feeds
{
titl=item.Field<string>("title"),
des=item.Field<string>("description")
};
foreach (var s in query)
{
feed.Add(s);
}
return feed;
}
}
public class feeds
{
public string titl { get; set; }
public string des { get; set; }
}
}
推荐答案
错误消息非常具体-您正在尝试为方法名称分配一个值(方法组"位是因为所有具有相同名称的方法是允许重载的组)
当你写
The error message is quite specific - you are trying to assign a value to a method name (The "method group" bit is because all methods with the same name are a group to allow for overloading)
When you write
proxy.getfeeds=ds;
相当于写作
It is the equivalent of writing
Console.WriteLine = "hello";
这篇关于无法分配给getfeed,因为它是方法组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文