【发布时间】:2009-05-07 15:52:53
【问题描述】:
我确定这确实很愚蠢,但我只是没有看到它..
pData.LocationHours 的类型为 BaseLocationHoursDataSet.LocationHoursDataTable。然而,当我将光标悬停在l 上时,我看到的只是“(range variable) TSource l”——这是为什么呢?为什么 linq 不知道它在处理什么?我用不同的 DataTable 尝试同样的事情,一切正常......不是这个人。可能是什么问题?
protected ListItem[] GetHoursTypesListItems(BaseLocationHoursDataSet pData)
{
return (
from l in pData.LocationHours // putting cursor over the l here shows: (range variable) TSource l
select new ListItem
{
Value = l, //ignore the fact that I didn't specify a property - that's the problem, that none of the properties of the object show up.
Text = l
}
).ToArray<ListItem>();
}
.
更新:
问题是它不知道 l 是什么。我没有向我显示正确的类型(我希望看到 LocationHoursRow),而是看到“TSource l”.. 那是什么?为什么它不知道“from l in pData.LocationHours”行中的 l 是什么?
【问题讨论】: