ListViewItem v = (ListViewItem) (from ListViewItem lvi in MyList where lvi.Text == e.Text select lvi).FirstOrDefault();>>>>
>>int index = (int)(from ListViewItem lvi in MyList where lvi.Text == e.Text select lvi.Index).FirstOrDefault(); >>>>>(will be 0 if not found)
int index = MyList.Where(i => i.Text == e.Text).Select(i => i.Index).DefaultIfEmpty(-999).FirstOrDefault();but at that point it's not much of an improvement on the original
int index = (int)(from ListViewItem lvi in MyList where lvi.Text == e.Text select lvi.Index).FirstOrDefault();but for some reason it doesn't work consistently - it finds the first item I search for but fails to find others I know are in the list - if I re-search the original item then look for another one - it *sometimes* finds it but not always. What I've found always works is this
e.Index = MyList.FindIndex(i => i.Text == e.Text);Any ideas as to why this is happening ? Thanks again for your help