New to Telerik UI for WPF? Start a free 30-day trial

Represents a thread-safe, synchronized collection that wraps an underlying source collection and provides additional functionality such as item transformation and disposal management.

The SynchronizedCollection<TItem> class is designed to synchronize changes between an underlying source collection and the synchronized collection. It supports wrapping items from the source collection using a transformation function and optionally disposing of items when they are removed from the collection. This collection is particularly useful in scenarios where changes to the source collection need to be reflected in a thread-safe manner, or when additional actions (e.g., cleanup) are required for items in the collection.

Definition

Namespace:Telerik.Windows.Core

Assembly:Telerik.Windows.Scheduling.Core.dll

Type Parameters:

TItem

The type of items contained in the collection.

Syntax:

C#
public class SynchronizedCollection<TItem> : BatchObservableCollection<TItem>, IList<TItem>, ICollection<TItem>, IList, ICollection, IReadOnlyList<TItem>, IReadOnlyCollection<TItem>, IEnumerable<TItem>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, IDisposable

Inheritance: objectCollection<TItem>ObservableCollection<TItem>BatchObservableCollection<TItem>SynchronizedCollection<TItem>

Implements: ICollectionICollection<TItem>IDisposableIEnumerableIEnumerable<TItem>IListIList<TItem>INotifyCollectionChangedINotifyPropertyChangedIReadOnlyCollection<TItem>IReadOnlyList<TItem>...

Inherited Members BatchObservableCollection<TItem>.InsertMany(int, IEnumerable<TItem>)BatchObservableCollection<TItem>.RemoveMany(int, int)BatchObservableCollection<TItem>.OnCollectionChanged(NotifyCollectionChangedEventArgs)ObservableCollection<TItem>.Move(int, int)ObservableCollection<TItem>.ClearItems()ObservableCollection<TItem>.RemoveItem(int)ObservableCollection<TItem>.InsertItem(int, TItem)ObservableCollection<TItem>.SetItem(int, TItem)ObservableCollection<TItem>.MoveItem(int, int)ObservableCollection<TItem>.OnPropertyChanged(PropertyChangedEventArgs)ObservableCollection<TItem>.BlockReentrancy()ObservableCollection<TItem>.CheckReentrancy()ObservableCollection<TItem>.CollectionChangedObservableCollection<TItem>.PropertyChangedCollection<TItem>.Add(TItem)Collection<TItem>.Clear()Collection<TItem>.CopyTo(TItem[], int)Collection<TItem>.Contains(TItem)Collection<TItem>.GetEnumerator()Collection<TItem>.IndexOf(TItem)Collection<TItem>.Insert(int, TItem)Collection<TItem>.Remove(TItem)Collection<TItem>.RemoveAt(int)Collection<TItem>.CountCollection<TItem>.ItemsCollection<TItem>.this[int]...

Methods

C#
public static SynchronizedCollection<TItem> Create(IEnumerable sourceCollection, Func<object, int, TItem> wrapFunction, Action<TItem> previewCollectionChangedAction = null, bool shouldDisposeItems = true)
Parameters:sourceCollectionIEnumerablewrapFunctionFunc<object, int, TItem>previewCollectionChangedActionAction<TItem>shouldDisposeItemsboolReturns:

SynchronizedCollection<TItem>

C#
public static SynchronizedCollection<TItem> Create(IEnumerable sourceCollection, Func<object, TItem> wrapFunction, bool shouldDisposeItems = true)
Parameters:sourceCollectionIEnumerablewrapFunctionFunc<object, TItem>shouldDisposeItemsboolReturns:

SynchronizedCollection<TItem>

C#
public static SynchronizedCollection<TItem> Create<TSourceItem>(IEnumerable<TSourceItem> sourceCollection, Func<TSourceItem, int, TItem> wrapFunction, bool shouldDisposeItems = true)
Parameters:sourceCollectionIEnumerable<TSourceItem>wrapFunctionFunc<TSourceItem, int, TItem>shouldDisposeItemsboolReturns:

SynchronizedCollection<TItem>

C#
public static SynchronizedCollection<TItem> Create<TSourceItem>(IEnumerable<TSourceItem> sourceCollection, Func<TSourceItem, TItem> wrapFunction, bool shouldDisposeItems = true)
Parameters:sourceCollectionIEnumerable<TSourceItem>wrapFunctionFunc<TSourceItem, TItem>shouldDisposeItemsboolReturns:

SynchronizedCollection<TItem>

C#
public void Dispose()

Implements: IDisposable.Dispose()

C#
protected virtual void Dispose(bool disposing)
Parameters:disposingbool