ForEachItem<T>(IAvaloniaReadOnlyList<T>, Action<T>, Action<T>, Action, Boolean) Method
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
Definition
Namespace: Avalonia.Collections
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public static IDisposable ForEachItem<T>(
this IAvaloniaReadOnlyList<T> collection,
Action<T> added,
Action<T> removed,
Action reset,
bool weakSubscription = false
)
<ExtensionAttribute>
Public Shared Function ForEachItem(Of T) (
collection As IAvaloniaReadOnlyList(Of T),
added As Action(Of T),
removed As Action(Of T),
reset As Action,
Optional weakSubscription As Boolean = false
) As IDisposable
[<ExtensionAttribute>]
static member ForEachItem :
collection : IAvaloniaReadOnlyList<'T> *
added : Action<'T> *
removed : Action<'T> *
reset : Action *
?weakSubscription : bool
(* Defaults:
let _weakSubscription = defaultArg weakSubscription false
*)
-> IDisposable
Parameters
- IAvaloniaReadOnlyList(T)
- The collection.
- 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.
- Action(T)
- An action called for each item removed from the collection. The parameters passed are the index in the collection and the item.
- Action
- An action called when the collection is reset.
- Boolean (Optional)
- Indicates if a weak subscription should be used to track changes to the collection.
Type Parameters
- The type of the collection items.
Return Value
IDisposable
A disposable used to terminate the subscription.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IAvaloniaReadOnlyList(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also
Reference
AvaloniaListExtensions Class
ForEachItem Overload
Avalonia.Collections Namespace