I have this list that is filled with data from sql
List<long>rightsList = new List<long>();
and a list view that is filled again with data from sql it has a tag the ID of Name that is shown on display
var lvItem = new ListViewItem(item.Name)
{
Tag = item.id
};
listview.items.add(lvItem);
Now i want to make a for loop that checks if the first list and the listview have any values in common and if yes to do something.
i tried something like this but doesnt work
for(int i=0; i<listview.Items.Count -1; i )
{
if(rightlist.contains((int)listview.tag))
{
// do something
}
else
{
//do something
}
CodePudding user response:
its correct just edit this line
for(int i=0; i<listview.Items.Count -1; i )
{
if(rightlist.contains((long)listview.items[i].tag))
{
// do something
}
else
{
//do something
}