private static int getGroupIndex(Group g) { int i; for (i = 0; i < AllGroups.Count; i++) { if (AllGroups[i].ID == g.ID) return i; } return -1; }