Export (0) Print
Expand All

BindingOperations::EnableCollectionSynchronization Method (IEnumerable, Object)

.NET Framework 4.6 and 4.5

Enables a collection to be accessed across multiple threads and specifies the lock object that should be used to synchronize access to the collection.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
static void EnableCollectionSynchronization(
	IEnumerable^ collection, 
	Object^ lockObject
)

Parameters

collection
Type: System.Collections::IEnumerable

The collection that needs synchronized access.

lockObject
Type: System::Object

The object to lock when accessing the collection.

If you have a lot of data to collect or modify, you might want to use a background thread to collect and modify the data so that the user interface will remain reactive to input. To enable multiple threads to access a collection, call the EnableCollectionSynchronization method. When you call this overload of the EnableCollectionSynchronization(IEnumerable, Object) method, the system locks the collection when you access it. To specify a callback to lock the collection yourself, call the EnableCollectionSynchronization(IEnumerable, Object, CollectionSynchronizationCallback) overload.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft