internal void RemoveThisNode(ParentNodeNotification notification) { OnRemoving(new ConfigurationNodeChangedEventArgs(this, parent)); for (int i = 0; i < childCount; i++) { childNodes[i].RemoveThisNode(ParentNodeNotification.DoNotNotify); } // since the name is based on site have to store to really remove it string nameToRemove = this.Name; RemoveNodeFromChildLookup(nameToRemove); hierarchy.RemoveNode(this); if ((notification == ParentNodeNotification.Notify) && (parent != null)) { parent.OnChildRemoving(new ConfigurationNodeChangedEventArgs(this, null)); parent.childNodes[index] = null; for (int i = index; i < parent.childCount - 1; ++i) { parent.childNodes[i] = parent.childNodes[i + 1]; parent.childNodes[i].index = i; } parent.childCount--; parent.OnChildRemoved(new ConfigurationNodeChangedEventArgs(this, null)); } parent = null; OnRemoved(new ConfigurationNodeChangedEventArgs(this, parent)); }