LINQ Queries
The Find.Byxxx methods now support Language-Integrated Query (LINQ) queries. Some of the Find functions are intended to be used by LINQ queries only. These include:
Methods | Description | Example |
---|---|---|
AllElements | Gets a IEnumerable for all elements to be used for LINQ queries. | var inlineStyledElements = Find.AllElements().Where(element => element.ContainsAttribute("style")); |
AllControls | Gets an IEnumerable for TControl to be used for LINQ queries. This will return only elements that are convertible to TControl. | var images = Find.AllControls |
Using LINQ we can create strongly typed advanced queries with intellisense support that we couldn't before. The most basic LINQ example is something like this:
We can also use lambda expressions like this: