Skip to content

Tag Archives: CSharp Dictionary Class

In C#, Dictionary is a generic collection which is generally used to store key/value pairs. Dictionary is defined under System.Collection.Generics namespace. It is dynamic in… Read More
In C#, Dictionary is a generic collection which is generally used to store key/value pairs. The working of Dictionary is quite similar to the non-generic… Read More
The Dictionary<TKey, TValue> Class in C# is a collection of Keys and Values. It is a generic collection class in the System.Collections.Generic namespace. The Dictionary… Read More
Equals(Object) Method which is inherited from the Object class is used to check if a specified Dictionary object is equal to another Dictionary object or… Read More
Dictionary<TKey, TValue>.GetEnumerator method is used to return an enumerator that iterates through the Dictionary<TKey, TValue>. Syntax: public System.Collections.Generic.Dictionary<TKey,TValue>.Enumerator GetEnumerator (); Return Value: This method returns… Read More
This property is used to get or set the value associated with the specified key in the Dictionary. Syntax: public TValue this[TKey key] { get;… Read More
This method is used to check whether the Dictionary<TKey,TValue> contains the specified key or not. Syntax: public bool ContainsKey (TKey key); Here, the key is… Read More
This method is used to check whether the Dictionary<TKey,TValue> contains a specific value or not. Syntax: public bool ContainsValue (TValue value); Here, the value is… Read More
This property is used to get the number of key/value pairs contained in the Dictionary. Syntax: public int Count { get; } Return Value :… Read More
This method is used to remove all key/value pairs from the Dictionary<TKey,TValue>. Syntax: public void Clear (); Below are the programs to illustrate the use… Read More
This method is used to remove the value with the specified key from the Dictionary<TKey,TValue>. Syntax: public bool Remove (TKey key); Return Value: This method… Read More
Dictionary<TKey,TValue>.Add() Method is used to add a specified key and value to the dictionary. Syntax: public void Add (TKey key, TValue value); Parameters: key: It… Read More
This property is used to get a collection containing the keys in the Dictionary. Syntax: public System.Collections.Generic.Dictionary<TKey, TValue>.KeyCollection Keys { get; } Return Value :… Read More
This property is used to get a collection containing the values in the Dictionary<TKey,TValue>. Syntax: public System.Collections.Generic.Dictionary<TKey, TValue>.KeyCollection Values{ get; } Return Value: This property… Read More