public void AddRangeUnique(GeoObjectList ObjectsToAdd) { // erst die überflüssigen entfernen, dann alle verbleibenden zufügen wg. ObjectAddedEvent for (int i = ObjectsToAdd.Count - 1; i >= 0; --i) { int index = list.IndexOf(ObjectsToAdd[i]); if (index >= 0) { ObjectsToAdd.Remove(i); } } AddRange(ObjectsToAdd); }
public virtual void Remove(int Index) { using (new Changing(this, "Add", containedObjects[Index])) { IGeoObject go = containedObjects[Index]; go.WillChangeEvent -= new ChangeDelegate(OnWillChange); go.DidChangeEvent -= new ChangeDelegate(OnDidChange); go.Owner = null; IColorDef cd = go as IColorDef; if (cd != null && cd.ColorDef != null) { if (cd.ColorDef.Source == ColorDef.ColorSource.fromParent) { cd.ColorDef = ColorDef.CDfromParent; } } lock (this) { containedObjects.Remove(Index); } } }