private void RaiseChangedEvent(EditorOptionDefinition definition) { // First, send out local events, but only if the change is valid in this scope if (Scope == null || definition.IsApplicableToScope(Scope)) { var tempEvent = OptionChanged; if (tempEvent != null) { tempEvent(this, new EditorOptionChangedEventArgs(definition.Name)); } } // Get rid of the expired refs DerivedEditorOptions.RemoveAll(weakref => !weakref.IsAlive); // Now, notify a copy of the derived options (since an event might modify the DerivedEditorOptions). foreach (var weakRef in new FrugalList <WeakReference>(DerivedEditorOptions)) { EditorOptions derived = weakRef.Target as EditorOptions; if (derived != null) { derived.OnParentOptionChanged(definition); } } }