Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
What is the best way to iterate over a Dictionary in C#?
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Dictionary<int, string> dic = new Dictionary<int, string>() { {5, "five"}, {6, "six"}, {7, "seven"}, {8, "eight"} }; foreach(var entry in dic) { Console.WriteLine(entry.Key+" - "+entry.Value); } } } }
run
|
edit
|
history
|
help
0
Interface fully qualified names
StringBuilder
75 94
Reference vs Value types (aka Classes vs Structs) in C#
bbbbbb
swapping
Extension Method Sample
07-05-20
Basic
transform string to hex code