AvaloniaListExtensions.

ForEachItem<T>(IAvaloniaReadOnlyList<T>, Action<T>, Action<T>, Action, bool) Method

Summary

Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
Namespace
Avalonia.Collections
Containing Type
AvaloniaListExtensions

Syntax

public static IDisposable ForEachItem<T>(this IAvaloniaReadOnlyList<T> collection, Action<T> added, Action<T> removed, Action reset, bool weakSubscription = false)

Type Parameters

Name Description
T The type of the collection items.

Parameters

Name Type Description
collection IAvaloniaReadOnlyList<T> The collection.
added Action<T> 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<T> 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.
weakSubscription bool Indicates if a weak subscription should be used to track changes to the collection.

Return Value

Type Description
IDisposable A disposable used to terminate the subscription.