Menu
Coddy logo textTech

What is a HashMap?

Part of the Logic & Flow section of Coddy's C# journey — lesson 46 of 66.

In C#, the equivalent of a HashMap is called a Dictionary. A Dictionary is a collection that stores key-value pairs, allowing you to quickly look up values using their associated keys.

Let's understand the basics:

A Dictionary stores data as key-value pairs

// The syntax is Dictionary<KeyType, ValueType>
Dictionary<string, int> ages = new Dictionary<string, int>();

Cheat sheet

A Dictionary stores key-value pairs and allows quick lookups by key:

// Syntax: Dictionary<KeyType, ValueType>
Dictionary<string, int> ages = new Dictionary<string, int>();

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Logic & Flow