Mid From PDF Collections C# Collections

How do you get all keys and values from a Dictionary<TKey, TValue>?

  • dictionary.Keys – returns a collection of all keys
  • dictionary.Values – returns a collection of all values

Example:

foreach (var key in dictionary.Keys)

Console.WriteLine(key);

foreach (var value in dictionary.Values)

Console.WriteLine(value);

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details