HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcsharpCritical

How to iterate over a dictionary?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
iteratehowoverdictionary

Problem

I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?

Solution

foreach(KeyValuePair entry in myDictionary)
{
// do something with entry.Value or entry.Key
}

Context

Stack Overflow Q#141088, score: 4597

Revisions (0)

No revisions yet.