Share via


BindingBase.EnableCollectionSynchronization Method

Definition

Enables synchronized (thread-safe) access to collection using the supplied callback.

public:
 static void EnableCollectionSynchronization(System::Collections::IEnumerable ^ collection, System::Object ^ context, Microsoft::Maui::Controls::CollectionSynchronizationCallback ^ callback);
public static void EnableCollectionSynchronization(System.Collections.IEnumerable collection, object context, Microsoft.Maui.Controls.CollectionSynchronizationCallback callback);
static member EnableCollectionSynchronization : System.Collections.IEnumerable * obj * Microsoft.Maui.Controls.CollectionSynchronizationCallback -> unit
Public Shared Sub EnableCollectionSynchronization (collection As IEnumerable, context As Object, callback As CollectionSynchronizationCallback)

Parameters

collection
IEnumerable

The collection that will be read or updated from multiple threads.

context
Object

A context object (optionally a lock object) passed to callback; may be null.

callback
CollectionSynchronizationCallback

Delegate invoked by the framework to perform collection access under synchronization.

Remarks

The framework holds only a weak reference to the collection. The callback receives parameters indicating whether write access is required; implementers should perform appropriate locking (often on context) before invoking the supplied access delegate.

Applies to