本文介绍了为什么没有这个LINQ查询工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图帮助别人了,写这个查询:
I was attempting to help someone else out and wrote this query:
var foundTab = (from tab in tabControl1.TabPages
where tab.Name == "tabName"
select tab).First();
和他们报告说,他们收到此错误:
And they reported that they received this error:
找不到
源类型
System.Windows.Forms.TabControl.TabPageCollection查询模式的实现。
'如果'未找到。考虑明确
指定范围内
变量'标签'的类型。
我查MSDN和 TabPageCollection
工具的IList
,的ICollection
,的IEnumerable
。那么,这是怎么回事吗?这是什么错误意味着是有另一种方式来查询选项卡控件的的TabPages
属性?
I checked MSDN and TabPageCollection
implements IList
, ICollection
, IEnumerable
. So, what's going on here? What does that error mean and is there another way to query the Tab Control's TabPages
property?
推荐答案
试试这个:
var tab = (from System.Windows.Forms.TabPage tab in tabControl1.TabPages
where tab.Name == "tabName"
select tab).First();
本代码指定的范围变量的类型。
This code specifies the type of the range variable.
这篇关于为什么没有这个LINQ查询工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!