Senior Software Engineer
int index = myList.FindIndex(a => a.Prop == oProp);
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; } }
int index; for (int i = 0; i < myList.Count; i++) { if (myList[i].Prop == oProp) { index = i; break; } }
No comments :
Post a Comment