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

collection
System.Collections.IEnumerable

The collection that was passed to EnableCollectionSynchronization(IEnumerable, Object, CollectionSynchronizationCallback).

context
System.Object

The context or lock object that was passed to EnableCollectionSynchronization(IEnumerable, Object, CollectionSynchronizationCallback).

accessMethod
System.Action

An action that reads or modifies collection.

writeAccess
System.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