Skip to content

Commit

Permalink
Remove unnecessary ForEachItem call
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkatz6 committed Aug 13, 2022
1 parent dd2f821 commit aac1e0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
33 changes: 0 additions & 33 deletions src/Avalonia.Base/Collections/AvaloniaDictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,6 @@ namespace Avalonia.Collections
/// </summary>
public static class AvaloniaDictionaryExtensions
{
/// <summary>
/// Invokes an action for each item in a collection and subsequently each item added or
/// removed from the collection.
/// </summary>
/// <typeparam name="T">The type of the collection items.</typeparam>
/// <param name="collection">The collection.</param>
/// <param name="added">
/// An action called initially for each item in the collection and subsequently for each
/// item added to the collection. The parameters passed are the index in the collection and
/// the item.
/// </param>
/// <param name="removed">
/// An action called for each item removed from the collection. The parameters passed are
/// the index in the collection and the item.
/// </param>
/// <param name="reset">
/// An action called when the collection is reset.
/// </param>
/// <param name="weakSubscription">
/// Indicates if a weak subscription should be used to track changes to the collection.
/// </param>
/// <returns>A disposable used to terminate the subscription.</returns>
public static IDisposable ForEachItem<TKey, TValue>(
this IAvaloniaReadOnlyDictionary<TKey, TValue> collection,
Action<TValue> added,
Action<TValue> removed,
Action reset,
bool weakSubscription = false)
where TKey : notnull
{
return collection.ForEachItem((_, i) => added(i), (_, i) => removed(i), reset, weakSubscription);
}

/// <summary>
/// Invokes an action for each item in a collection and subsequently each item added or
/// removed from the collection.
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.Base/Controls/ResourceDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ public IDictionary<ThemeVariant, IResourceProvider> ThemeDictionaries
{
_themeDictionary = new AvaloniaDictionary<ThemeVariant, IResourceProvider>();
_themeDictionary.ForEachItem(
x =>
(_, x) =>
{
if (Owner is object)
{
x.AddOwner(Owner);
}
},
x =>
(_, x) =>
{
if (Owner is object)
{
Expand Down

0 comments on commit aac1e0c

Please sign in to comment.