Possible duplicate:
LINQ equivalent of foreach for IEnumerable <T>
please help me figure out how to replace the loop below with the linq expression:
using System.Web.UI.WebControls;
...
Table table = ...;
BulletedList list = new BulletedList();
foreach (TableRow r in table.Rows)
{
list.Items.Add(new ListItem(r.ToString()));
}
This is a contrived example; in fact, I am not going to convert strings to strings, of course.
I ask how to use BulletedList.AddRange and provide it with an array of elements created from the table using the linq statement.
thank! Konstantin
source
share