private void deleteReferenceFromAll(System.Object reference) { int i = 0; while (i < allReferencesDataControl.Count) { ElementContainer element = allReferencesDataControl[i]; if (!element.isPlayer() && element.getErdc().getContent() == reference) { allReferencesDataControl.RemoveAt(i); } else { i++; } } }