    

 ## On this page

  

 

 # Class ObservableKeyedCollection&lt;TKey, TItem\\&gt;

 Last update: 09.03.2026 

<a id="VM_Collections_ObservableKeyedCollection_2"></a>

Namespace: [VM.Collections](VM.Collections.md)  
Assembly: VM.dll

```csharp
public class ObservableKeyedCollection<TKey, TItem> : ObservableKeyedCollectionBase<TKey, TItem>

```

#### Type Parameters

`TKey`

`TItem`

#### Inheritance

object ← Collection&lt;TItem&gt; ← KeyedCollection&lt;TKey, TItem&gt; ← [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;](VM.Collections.ObservableKeyedCollectionBase-2.md) ← [ObservableKeyedCollection&lt;TKey, TItem&gt;](VM.Collections.ObservableKeyedCollection-2.md)

#### Inherited Members

[ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.AddRange(IEnumerable&lt;TItem&gt;)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_AddRange_System_Collections_Generic_IEnumerable__1__), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.TryGetValue(TKey, out TItem)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_TryGetValue__0__1__), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.ClearItems()](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_ClearItems), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.InsertItem(int, TItem)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_InsertItem_System_Int32__1_), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.OnCollectionChanged(NotifyCollectionChangedEventArgs)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_OnCollectionChanged_System_Collections_Specialized_NotifyCollectionChangedEventArgs_), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.RemoveItem(int)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_RemoveItem_System_Int32_), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.SetItem(int, TItem)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_SetItem_System_Int32__1_), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.&lt;&gt;OnPropertyChanged(PropertyChangedEventArgs)](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2___OnPropertyChanged_System_ComponentModel_PropertyChangedEventArgs_), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.CollectionChanged](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_CollectionChanged), [ObservableKeyedCollectionBase&lt;TKey, TItem&gt;.PropertyChanged](VM.Collections.ObservableKeyedCollectionBase-2.md#VM_Collections_ObservableKeyedCollectionBase_2_PropertyChanged)

## Constructors

### <a id="VM_Collections_ObservableKeyedCollection_2__ctor_System_Func__1__0__"></a> ObservableKeyedCollection(Func&lt;TItem, TKey&gt;)

```csharp
public ObservableKeyedCollection(Func<TItem, TKey> getKeyForItem)

```

#### Parameters

`getKeyForItem` Func&lt;TItem, TKey&gt;

## Methods

### <a id="VM_Collections_ObservableKeyedCollection_2_GetKeyForItem__1_"></a> GetKeyForItem(TItem)

```csharp
protected override TKey GetKeyForItem(TItem item)

```

#### Parameters

`item` TItem

#### Returns

TKey