SynchronizedKeyedCollection
Represents a thread-safe keyed collection that provides synchronization for its operations.
継承元: KeyedCollection<T, T>
実装: ISynchronizedCollection<KeyValuePair<T, T>>, ISynchronizedCollection, ISynchronizable, ICollection<KeyValuePair<T, T>>, IEnumerable<KeyValuePair<T, T>>, IEnumerable
コンストラクター
protected SynchronizedKeyedCollection()
synchronizedKeyedCollection = SynchronizedKeyedCollection()
Initializes a new instance of the SynchronizedKeyedCollection class.
protected SynchronizedKeyedCollection(IEqualityComparer<TKey> comparer)
synchronizedKeyedCollection = SynchronizedKeyedCollection(comparer)
Initializes a new instance of the SynchronizedKeyedCollection class with the specified equality comparer.
- comparer
- The equality comparer to use when comparing keys.
プロパティ
public override TValue Item { set; }
synchronizedKeyedCollection.Item = value
Gets or sets the value associated with the specified key.
- key
- The key of the value to get or set.
戻り値: The value associated with the specified key.
private SynchronizedDictionary<TKey, TValue> SyncDict { get; }
value = synchronizedKeyedCollection.SyncDict
Gets the synchronized dictionary used internally by the collection.
public Lock SyncRoot { get; }
value = synchronizedKeyedCollection.SyncRoot
Gets the synchronization root object used to synchronize access to the collection.
メソッド
public override void Clear()
synchronizedKeyedCollection.Clear()
Removes all keys and values from the collection.
public Scope EnterScope()
result = synchronizedKeyedCollection.EnterScope()
Enters a synchronized scope for thread-safe operations on the collection.
戻り値: A Scope that represents the synchronized scope.
public override bool Remove(TKey key)
result = synchronizedKeyedCollection.Remove(key)
Removes the value with the specified key from the collection.
- key
- The key of the element to remove.
戻り値: true if the element is successfully found and removed; otherwise, false.