Get the index of item in a list given its property

You could use FindIndex

string myName = "ComTruise";
int myIndex = MyList.FindIndex(p => p.Name == myName);

Note: FindIndex returns -1 if no item matching the conditions defined by the supplied predicate can be found in the list.

Leave a Comment