public IEnumerator <ResourceDictionary> GetResourceDictionariesWhere(Func <ResourceDictionary, bool> predicate)
        {
            ResourceDictionaryEnumerator enumerator = new ResourceDictionaryEnumerator(this, predicate);

            _ignoreResourceDictionaryDispensedByEnumerator = true;
            try
            {
                foreach (ResourceDictionaryDispensedEventArgs args in _resourceDictionariesDispensed)
                {
                    enumerator.ResourceDictionaryDispenserResourceDictionaryDispensed(this, args);
                }
            }
            finally
            {
                _ignoreResourceDictionaryDispensedByEnumerator = false;
            }

            _resourceDictionaryEnumerators.Add(enumerator);
            return(enumerator);
        }
 /// <summary>
 /// Unregisters an enumerator so that it can be garbage collected.
 /// </summary>
 /// <param name="enumerator">The enumerator.</param>
 internal void Unregister(ResourceDictionaryEnumerator enumerator)
 {
     _resourceDictionaryEnumerators.Remove(enumerator);
 }