Skip to main content

WeakSubscribe(INotifyCollectionChanged, Action<NotifyCollectionChangedEventArgs>) Method

Subscribes to the CollectionChanged event using a weak subscription.

Definition​

Namespace: Avalonia.Collections
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static IDisposable WeakSubscribe(
this INotifyCollectionChanged collection,
Action<NotifyCollectionChangedEventArgs> handler
)

Parameters​

  INotifyCollectionChanged
The collection.
  Action(NotifyCollectionChangedEventArgs)
An action called when the collection event is raised.

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 INotifyCollectionChanged. 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​

NotifyCollectionChangedExtensions Class
WeakSubscribe Overload
Avalonia.Collections Namespace