How can I find the index of an item in a list without looping through it?
Currently this doesn\'t look very nice - searching through the list for the same item twice
If you don't want to use LINQ, then:
int index; for (int i = 0; i < myList.Count; i++) { if (myList[i].Prop == oProp) { index = i; break; } }
this way you are iterating list only once.