string categoryIDList = Convert.ToString(reader["categoryIDList"]);
if (!String.IsNullOrEmpty(categoryIDList))
{
c.CategoryIDList =
new List<int>().AddRange(
categoryIDList
.Split(',')
.Select(s => Convert.ToInt32(s)));
}
该类有一个属性IList CategoryIDList,我试图在上面指定它。不能隐式地将void类型转换为IList <int>
错误:
错误1无法隐式转换类型 '无效' 到 'System.Collections.Generic.IList'
不知道是什么问题?
Arghh,IList的不支持的AddRange关系吗? c.CategoryIDList是IList类型 –
mrblah
2009-10-07 00:45:38
是的,这不会按原样编译。 – 2009-10-07 01:02:08
@homestead&Reed Copsey:对,对不起。简单的解决方案就是使用'List'类型的临时变量。看到我的编辑可能的解决方案。 –
2009-10-07 01:27:44