我不明白如何解决此问题。我将需要您的帮助和解释如何解决它。 我用一个WebService来填充具有艺术家名字的DropDownList。
这里是代码behing。无法解析客户端对象的返回值WebService
private List<ArtistServiceReference.ArtistServiceClient> ArtistDetail()
{
ArtistServiceReference.ArtistServiceClient client =
new ArtistServiceReference.ArtistServiceClient();
ArtistServiceReference.Artist[] artists = client.ArtistDetail();
return artists.ToList(); <=== errror here
无法隐式转换类型System.Collections.Generic.List<ArtistServiceReference.Artist>
到System.Collections.Generic.List<ArtistServiceReference.ArtistServiceClient>
这里是ArtistService.cs
public class ArtistService : IArtistService
{
public List<Artist> ArtistDetail()
{
using (ArtistDataContext db = new ArtistDataContext())
{
return (from artist in db.Artists
select new Artist()
{
Id = artist.Id,
Artist_nom = artist.Artist_nom
}).ToList();
}
}
}
难道你不明白什么部分错误消息的? – SLaks
我不明白为什么它不让我返回一个ToList()来填充我的下拉列表 – user3127986
_Read the error message_。它告诉你到底你做错了什么。 – SLaks