Repository: AvaloniaUI/Avalonia
File: src/Avalonia.Base/Controls/ResourceDictionary.cs (C#)

Code before:
                return false;
            }
        }

        bool ICollection<KeyValuePair<object, object?>>.IsReadOnly => false;

        private Dictionary<object, object?> Inner => _inner ??= new();
        
        public void Add(object key, object? value)
        {
            Inner.Add(key, value);
            Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
        }

        public void AddDeferred(object key, Func<IServiceProvider?, object?> factory)
            => Add(key, new DeferredItem(factory));

        public void AddDeferred(object key, IDeferredContent deferredContent)
            => Add(key, deferredContent);

        public void AddNotSharedDeferred(object key, IDeferredContent deferredContent)
            => Add(key, new NotSharedDeferredItem(deferredContent));

        public void AddOrUpdateRange(IEnumerable<KeyValuePair<object, object?>> values)
        {
            _suspendNotifications = true;
            try
            {
                foreach (var value in values)
                    Inner[value.Key] = value.Value;
            }
            finally
            {
                _suspendNotifications = false;
                NotifyHostedResourcesChanged(Owner);
            }
        }
        
        public void Clear()
        {
            if (_inner?.Count > 0)
            {
                _inner.Clear();
                Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
            }
        }

        public bool ContainsKey(object key) => _inner?.ContainsKey(key) ?? false;

        public bool Remove(object key)
        {

Review comment (suggestion):
Do you still need this flag? Only the `Inner` dictionary's indexer is called by this method, which shouldn't trigger any notification directly.

Code after:
                return false;
            }
        }

        bool ICollection<KeyValuePair<object, object?>>.IsReadOnly => false;

        private Dictionary<object, object?> Inner => _inner ??= new();
        
        public void Add(object key, object? value)
        {
            Inner.Add(key, value);
            Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
        }

        public void AddDeferred(object key, Func<IServiceProvider?, object?> factory)
            => Add(key, new DeferredItem(factory));

        public void AddDeferred(object key, IDeferredContent deferredContent)
            => Add(key, deferredContent);

        public void AddNotSharedDeferred(object key, IDeferredContent deferredContent)
            => Add(key, new NotSharedDeferredItem(deferredContent));

        public void SetItems(IEnumerable<KeyValuePair<object, object?>> values)
        {
            try
            {
                foreach (var value in values)
                    Inner[value.Key] = value.Value;
            }
            finally
            {
                Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);            
            }
        }
        
        public void Clear()
        {
            if (_inner?.Count > 0)
            {
                _inner.Clear();
                Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty);
            }
        }

        public bool ContainsKey(object key) => _inner?.ContainsKey(key) ?? false;

        public bool Remove(object key)
        {
            if (_inner?.Remove(key) == true)
            {