KeyedObservableCollection<T> Class
Provides a generic keyed collection that provides notifications when items are added or removed.
public class KeyedObservableCollection<T> : SimpleObservableCollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IKeyedObservableCollection<T>, IObservableCollection<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable where T : class, IKeyedObject
- Type Parameters:
-
T
-
- Inheritance:
- System.Object System.Collections.ObjectModel.Collection<T> SimpleObservableCollection<T> Object
- Derived:
- LexicalStateCollection KeyedSynchronizedCollection<T> EditorViewMarginCollection PrinterViewMarginCollection
- Implements:
- IKeyedObservableCollection<T> IObservableCollection<T>
Constructors
KeyedObservableCollection()
public KeyedObservableCollection()
Properties
Item[String]
Gets the T
with the specified key.
[C#] In C#, this property is the indexer for the IKeyedObservableCollection
interface.
public virtual T this[string key] { get; }
Parameter | Type | Description |
---|---|---|
key | System.String | The key of the |
Property Value
- T:
The
T
with the specified key.
Methods
Contains(String)
Determines whether a T
with the specified key is in the collection.
public bool Contains(string key)
Parameter | Type | Description |
---|---|---|
key | System.String | The key to locate in the collection. |
Returns
- System.Boolean:
true
if aT
with the specified key is found in the collection; otherwise,false
.
IndexOf(String)
Searches for a T
with the specified key and returns the zero-based index of the
first occurrence within the entire collection.
public virtual int IndexOf(string key)
Parameter | Type | Description |
---|---|---|
key | System.String | The key to locate in the collection. |
Returns
- System.Int32:
The zero-based index of the first occurrence of a
T
with the specified key within the entire collection, if found; otherwise,-1
.
Remove(String)
Removes the T
with the specified key.
public virtual bool Remove(string key)
Parameter | Type | Description |
---|---|---|
key | System.String | The key to locate in the collection. |
Returns
- System.Boolean:
true
if aT
was removed; otherwise,false
.
Inherited Members
- SimpleObservableCollection<T>.BlockReentrancy()
- SimpleObservableCollection<T>.CheckReadOnly()
- SimpleObservableCollection<T>.CheckReentrancy()
- SimpleObservableCollection<T>.ClearItems()
- SimpleObservableCollection<T>.InsertItem(Int32, T)
- SimpleObservableCollection<T>.OnItemAdded(Int32, T)
- SimpleObservableCollection<T>.OnItemAdding(Int32, T)
- SimpleObservableCollection<T>.OnItemRemoved(Int32, T)
- SimpleObservableCollection<T>.OnItemRemoving(Int32, T)
- SimpleObservableCollection<T>.RemoveItem(Int32)
- SimpleObservableCollection<T>.SetItem(Int32, T)
- SimpleObservableCollection<T>.IsReadOnly
- SimpleObservableCollection<T>.ItemAdding
- SimpleObservableCollection<T>.ItemAdded
- SimpleObservableCollection<T>.ItemRemoving
- SimpleObservableCollection<T>.ItemRemoved
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()