Check same elements in two lists
I have a List and a ListItemCollection and want to check if there have the
same elements.
First, I fill the ListItemCollection with Text and Value. (After a SQL
Select)
ListItemCollection tempListName = new ListItemCollection();
ListItem temp_ListItem;
if (reader.HasRows)
{
while (reader.Read())
{
temp_ListItem = new ListItem(reader[1].ToString(),
reader[0].ToString());
tempListName.Add(temp_ListItem);
}
}
and I have the List
List<string> tempList = new List<string>(ProfileArray);
with some values like {"1","4","5","7"}
now, I want to check, if the tempList have maybe some elements with the
same value in tempListName and read the text from the value in a new list.
Note: Im using asp.net 2.0.
No comments:
Post a Comment