private void btnOK_Click(object sender, EventArgs e) { _resultList.Clear(); ListView.CheckedListViewItemCollection lvCheckedItems = this.lvToInfo.CheckedItems; _resultList = lvCheckedItems.Cast <ListViewItem>().Select((lvItem) => lvItem.SubItems[1].Text.ToString()).ToList(); DialogResult = DialogResult.OK; }
private static bool IsContains(ListView.CheckedListViewItemCollection checkedListViewItemCollection, string name) { return(checkedListViewItemCollection.Cast <ListViewItem>().Any(item => item.Text == name)); }