我有这样定义的列表:C#的LINQ - 无法隐式转换IEnumerable的<string>列出<string>
public List<string> AttachmentURLS;
我将项目添加到列表如下:
instruction.AttachmentURLS = curItem.Attributes["ows_Attachments"].Value.Split(';').ToList().Where(Attachment => !String.IsNullOrEmpty(Attachment));
但我正在逐渐此错误:不能隐式转换IEnumerable到列表
我做错了什么?
您是否尝试添加类型转换? instruction.AttachmentURLS =(列表)curItem.Attributes ... 当然,我忘了.ToList()方法。只需将其添加到最后。 –
Nilbert
2010-05-17 23:31:41