This website collects cookies to deliver better user experience
C# Dictionary
C# Dictionary
The Dictionary in C# is a generic collection, which is used to store data in key-value pairs. It is available under the System.Collections.Generic namespace.
publicclassDictionary<TKey,TValue>
Parameters
TKey
It represents the data type of the key. For example, string, bool, int, etc.
TValue
It represents the data type of the value.
Creating a Dictionary
The Dictionary collection provides an Add() method to add elements to it.