Table of Contents

Class AvaloniaDictionaryExtensions

Namespace
Avalonia.Collections
Assembly
Avalonia.Base.dll

Defines extension methods for working with AvaloniaList<T>s.

public static class AvaloniaDictionaryExtensions
Inheritance
AvaloniaDictionaryExtensions
Inherited Members

Methods

ForEachItem<TKey, TValue>(IAvaloniaReadOnlyDictionary<TKey, TValue>, Action<TKey, TValue>, Action<TKey, TValue>, Action, bool)

Invokes an action for each item in a collection and subsequently each item added or removed from the collection.

public static IDisposable ForEachItem<TKey, TValue>(this IAvaloniaReadOnlyDictionary<TKey, TValue> collection, Action<TKey, TValue> added, Action<TKey, TValue> removed, Action reset, bool weakSubscription = false) where TKey : notnull

Parameters

collection IAvaloniaReadOnlyDictionary<TKey, TValue>

The collection.

added Action<TKey, TValue>

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.

removed Action<TKey, TValue>

An action called for each item removed from the collection. The parameters passed are the index in the collection and the item.

reset Action

An action called when the collection is reset. This will be followed by calls to added for each item present in the collection after the reset.

weakSubscription bool

Indicates if a weak subscription should be used to track changes to the collection.

Returns

IDisposable

A disposable used to terminate the subscription.

Type Parameters

TKey

The key type of the collection items.

TValue

The value type of the collection items.