This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- HashSet 5:29
- Hashing 6:48
- GetHashCode and Equals Methods 4:03
- Hash Codes and Object Equality 5 questions
- Dictionary 11:29
- Dictionary 1 objective
- Dictionary Keys and Values 6:06
- Using Dictionaries 2 objectives
- The System.Collections.Generic Namespace 3:00
- The System.Collections Namespace 3:24
- Other Collection Types 4 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
When we need to quickly look up items in a collection, a dictionary is the way to go.
System.Collections.Generic.Dictionary
private static Dictionary<char, string> _textToMorse = new Dictionary<char, string>
{
{' ', "/"},
{'A', ".-"},
{'B', "-..."},
{'C', "-.-."},
{'D', "-.."},
{'E', "."},
{'F', "..-."},
{'G', "--."},
{'H', "...."},
{'I', ".."},
{'J', ".---"},
{'K', "-.-"},
{'L', ".-.."},
{'M', "--"},
{'N', "-."},
{'O', "---"},
{'P', ".--."},
{'Q', "--.-"},
{'R', ".-."},
{'S', "..."},
{'T', "-"},
{'U', "..-"},
{'V', "...-"},
{'W', ".--"},
{'X', "-..-"},
{'Y', "-.--"},
{'Z', "--.."},
{'1', ".----"},
{'2', "..---"},
{'3', "...--"},
{'4', "....-"},
{'5', "....."},
{'6', "-...."},
{'7', "--..."},
{'8', "---.."},
{'9', "----."},
{'0', "-----"},
{',', "--..--"},
{'.', ".-.-.-"},
{'?', "..--.."},
{';', "-.-.-."},
{':', "---..."},
{'/', "-..-."},
{'-', "-....-"},
{'\'', ".----."},
{'"', ".-..-."},
{'(', "-.--."},
{')', "-.--.-"},
{'=', "-...-"},
{'+', ".-.-."},
{'@', ".--.-."},
{'!', "-.-.--"},
{'Á', ".--.-"},
{'É', "..-.."},
{'Ö', "---."},
{'Ä', ".-.-"},
{'Ñ', "--.--"},
{'Ü', "..--"}
};
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Scott George
19,060 Points2 Answers
-
Peter Furler
31,647 Points2 Answers
-
PLUS
Baw Gadwe
Courses Plus Student 326 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up