Ranorex.Table and LINQ

Ask general questions here.
atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Ranorex.Table and LINQ

Post by atom » Tue Feb 02, 2010 5:34 pm

Hiya

If i have a Ranorex.Table control, that contains 20 columns and 5000 rows, and i want to search to find all rows that have:

- Column1 = "Hello"
- Column2 = "World"
- Column3 = "Nice"
- Column4 = "Day"
- etc.


I could build a quite large ranorex xpath for that.
What would be better (I dont know if its possible) is to write a LINQ query on the Table.Rows collection
e.g.

Dim myrows = From row in Table.Rows where row.item("Column1") = "Hello" ... select row

Is that possible?

Regards

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex.Table and LINQ

Post by Support Team » Wed Feb 03, 2010 9:28 pm

Sure, you can use LINQ to select rows in a table. Ranorex uses standard .NET collection types that LINQ can be used with, e.g. the Table.Rows property returns a list of type System.Collections.Generic.IList<Row>. In your situation using LINQ is definitely preferable to RanoreXPath, since the C# or VB.NET compiler can check your statement for syntax errors.

Regards,
Alex
Ranorex Support Team
.
Image

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: Ranorex.Table and LINQ

Post by atom » Thu Feb 04, 2010 10:26 am

nice, thanks!