Is there a way to take out the foreach in the following code in linq yet produce the same output?
DropDownList ddl = new DropDownList();
foreach (DataRow row in ds.Tables[0].Rows)
{
if ((byte)row["ListTypeID"] == 0)
{
item = new ListItem(row["ListText"].ToString(), string.Format("{0}:{1}", row["ListTypeID"].ToString(), row["ListID"].ToString()));
ddl.Items.Add(item);
}
else
{
item = new ListItem(row["ListText"].ToString(), string.Format("{0}", row["ListID"].ToString()));
ddl.Items.Add(item);
}
}