Iterate over a Dictionary
What is the best way to iterate over a Dictionary in C#?
Dictionary < TKey, TValue > Class
The Dictionary < TKey, TValue > class is a generic class and you can store any Data Types. The C# Dictionary Add method takes two parameters, which mapping from a set of keys to a set of values. Each insertion to the Dictionary consists of a Key and its associated Value
Dictionary Add
public void Add(TKey key,TValue value)
Retrieve Values from C# Dictionary

There are many different ways to iterate over a Dictionary in C#
Retrieve C# Dictionary Kay and Value
You can use for loop also because sometimes you need a counter value. In that case you should use ElementAt() method that provides by LINQ. In this case you should, using System.Linq;
How to C# Dictionary
A Dictionary class is a data structure that represents a collection of keys and values pair of data. The key is identical in a key-value pair and it can have at most one value in the dictionary, but a value can be associated with many different keys. More about.... C# Dictionary
Dictionary Versus HashTable

Dictionary is a generic type, Hashtable is not. That means you get type safety with Dictionary, because you can't insert any random object into it, and you don't have to cast the values you take out. Since both Dictionary and Hashtable are internally hashtables, so fast access to many-item data according to key, also both need immutable and unique keys. More about.... Dictionary Vs HashTable
Dictionary Versus List

Both lists and dictionaries are used to store collections of data. The Dictionary is based on a hash table, that means it uses a hash lookup, which is a rather efficient algorithm to look up things, on the other hand, a list you have to go element by element until it finds the result from beginning to the result each time. More about.... Dictionary vs List
NEXT.....String to byte Array