CollectionSynchronizationCallback Delegate

Definition

public delegate void CollectionSynchronizationCallback(IEnumerable collection, object context, Action accessMethod, bool writeAccess);
type CollectionSynchronizationCallback = delegate of IEnumerable * obj * Action * bool -> unit

Parameters

accessMethod
Action

An action that reads or modifies collection.

writeAccess
Boolean

A value that tells whether write access is required by accessMethod.

Remarks

Application developers implement a CollectionSynchronizationCallback method and pass it to the EnableCollectionSynchronization(IEnumerable, Object, CollectionSynchronizationCallback) method to enable correct multithreaded access to collection. After synchronization is enabled, the Xamarin.Forms framework passes accessMethod to the application developer's implementation of CollectionSynchronizationCallback each time that the framework needs to modify the collection in a multithreaded environment. The application developer's implementation should decide, based on the context object (which may be merely a locking object or the object on which the collection lives) and the value of the writeAccess parameter, whether or not to lock while calling accessMethod.

Applies to