public int GetOverrideIndexFromListID(int lstid) { int returnVal = -1; int size = _overrideList.Count; for (int x = 0; x < size; x++) { ListFormatOverride next = _overrideList[x]; if (next.GetLsid() == lstid) { // 1-based index I think returnVal = x + 1; break; } } if (returnVal == -1) { throw new InvalidDataException("No list found with the specified ID"); } return(returnVal); }