Lecture overview -- Keyboard shortcut: 'u'  Previous page: Overview of Generic Dictionaries in C# -- Keyboard shortcut: 'p'  Next page: Overview of the class <b><kbd>Dictionary<K,V></kbd></b> -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 25 : 36
Object-oriented Programming in C#
Collection Classes
The interface IDictionary<K,V>

The interface IDictionary<K,V> is a subinterface of ICollection<KeyValuePair<K,V>>

 

  • Operations in the interface IDictionary<K,V>

    • The operations prescribed in ICollection<KeyValuePair<K,V>>

    • The operations prescribed in IEnumerable<KeyValuePair<K,V>>

    • V this[K key]     - both getter and setter; the setter adds or mutates

    • void Add(K key, V value)     - only possible if key is not already present

    • bool Remove(K key)

    • bool ContainsKey(K key)

    • bool TryGetValue(K key, out V value)

    • ICollection<K>Keys     - getter

    • ICollection<V>Values     - getter