我试图帮助别人了,写这个查询:为什么这个LINQ Query不工作?
var foundTab = (from tab in tabControl1.TabPages
where tab.Name == "tabName"
select tab).First();
而且他们报告说,他们收到此错误:
Could not find an implementation of the query pattern for source type System.Windows.Forms.TabControl.TabPageCollection'. 'Where' not found. Consider explicitly specifying the type of the range variable 'tab'.
我查MSDN和TabPageCollection
工具IList
,ICollection
,IEnumerable
。那么,这里发生了什么?那个错误是什么意思,还有另一种方式来查询选项卡控件的TabPages
属性?
我总是忘记一个:) – leppie 2009-10-06 03:49:15
看起来比cast方法更清洁。谢谢! – jasonh 2009-10-06 03:53:20