Class CachedSynchronizedSet<T>
- Namespace
- Ecng.Collections
- Assembly
- Ecng.Collections.dll
Represents a thread-safe set with a cached array of its elements for improved performance.
public class CachedSynchronizedSet<T> : SynchronizedSet<T>, INotifyList<T>, INotifyCollection<T>, IList<T>, IList, ICollection, ISynchronizedCollection<T>, ISynchronizedCollection, ISet<T>, ICollectionEx<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
TThe type of elements in the set.
- Inheritance
-
BaseCollection<T, ISet<T>>SynchronizedCollection<T, ISet<T>>CachedSynchronizedSet<T>
- Implements
-
INotifyList<T>IList<T>ISet<T>ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
CachedSynchronizedSet()
Initializes a new instance of the CachedSynchronizedSet<T> class.
public CachedSynchronizedSet()
CachedSynchronizedSet(bool)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified indexing option.
public CachedSynchronizedSet(bool allowIndexing)
Parameters
allowIndexingboolA value indicating whether indexing is allowed.
CachedSynchronizedSet(bool, IEnumerable<T>, IEqualityComparer<T>)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified indexing option, collection, and equality comparer.
public CachedSynchronizedSet(bool allowIndexing, IEnumerable<T> collection, IEqualityComparer<T> comparer)
Parameters
allowIndexingboolA value indicating whether indexing is allowed.
collectionIEnumerable<T>The collection whose elements are copied to the new set.
comparerIEqualityComparer<T>The equality comparer to use when comparing elements.
CachedSynchronizedSet(bool, IEqualityComparer<T>)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified indexing option and equality comparer.
public CachedSynchronizedSet(bool allowIndexing, IEqualityComparer<T> comparer)
Parameters
allowIndexingboolA value indicating whether indexing is allowed.
comparerIEqualityComparer<T>The equality comparer to use when comparing elements.
CachedSynchronizedSet(IEnumerable<T>)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified collection.
public CachedSynchronizedSet(IEnumerable<T> collection)
Parameters
collectionIEnumerable<T>The collection whose elements are copied to the new set.
CachedSynchronizedSet(IEnumerable<T>, IEqualityComparer<T>)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified collection and equality comparer.
public CachedSynchronizedSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
Parameters
collectionIEnumerable<T>The collection whose elements are copied to the new set.
comparerIEqualityComparer<T>The equality comparer to use when comparing elements.
CachedSynchronizedSet(IEqualityComparer<T>)
Initializes a new instance of the CachedSynchronizedSet<T> class with the specified equality comparer.
public CachedSynchronizedSet(IEqualityComparer<T> comparer)
Parameters
comparerIEqualityComparer<T>The equality comparer to use when comparing elements.
Properties
Cache
Gets a cached array of the elements in the set.
public T[] Cache { get; }
Property Value
- T[]
Remarks
The array is cached for performance and is reset when the set is modified.
Methods
OnChanged()
Called when the set is modified to reset the cached array.
protected override void OnChanged()