I am using C# 2.0, and I can't help but think this isn't the most efficient way to search a collection (in this case a DataTable) for a value:
bool found = false;
foreach (DataRow row in data.Rows)
{
if (id == row["rowID"])
{
found = true;
break;
}
}
if (!found)
{
//Do stuff here
}
Can anyone think of a "cleaner" way to do this?