Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #329 Read value in a map

Assign to v the value stored in the map m for the key k.

Explain what happens if there is no entry for k in m.

var v = m[k];

If no entry, throw an exception; use TryGetValue or GetValueOrDefault instead.

New implementation...
< >
programming-idioms.org