private bool HasPort(Port port) { bool found = false; foreach (ListViewItem lvi in lvInterface.Items) { var port1 = lvi.Tag as Port; if (port1 != null) found |= port1.name.Equals(port.name); } return found; }