[英]Why does my IEnumerator<AppiumWebElement> not have .Where()?
标题主要解释了我的问题,我的IEnumerable<AppiumWebElement>
没有.Where
方法,我希望了解原因。
我有一个返回IEnumerable<AppiumWebElement>
,如下所示:
public IEnumerable<AppiumWebElement> GetLayers()
{
var items = PaneOrView.FindElementsByClassName("TreeViewItem");
List<AppiumWebElement> layers = new List<AppiumWebElement>();
foreach(AppiumWebElement item in items)
{
string automationId = item.AutomationId();
if (automationId != null && automationId.Contains("Layer"))
{
layers.Add(item);
}
}
return layers.AsEnumerable();
}
当我检查此方法中的返回项上是否存在.Where
(使用代码完成),我得到了我希望从IEnumerable
看到的方法的完整列表。
但是,当我稍后从另一个命名空间使用此方法时,例如:
var test = Contents.GetLayers();
test
中的结果不包含.Where
或我希望从IEnumerable
看到的任何其他方法。 知道为什么吗?
感谢您的任何指点!
Linq
中的Where()
和其他方法是您正在使用的扩展方法。 您需要导入System.Linq
:
using System.Linq;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.