Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IDictionary<int, string> numberNames = new Dictionary<int, string>();
- numberNames.Add(1,"One");
- numberNames.Add(2,"Two");
- numberNames.Add(3,"Three");
- foreach(KeyValuePair<int, string> kvp in numberNames)
- Console.WriteLine("Key: {0}, Value: {1}", kvp.Key, kvp.Value);
- var cars = new Dictionary<string, string>(){
- {"FIAT", "FIAT Topolino, FIAT 500, FIAT 600, FIAT Cinquecento, FIAT 126"},
- {"Ferrari", "Ferrari 166 Inter, Ferrari 250 GT/E, Ferrari California T, Ferrari Berlinetta Boxer 365 GT/4 BB, Ferrari Dino 206 GT"},
- {"Trabant", "Trabant P50, Trabant 600, Trabant 601, Trabant 1.1, Trabant 800RS"}
- };
- foreach(var kvp in cars)
- Console.WriteLine("Key: {0}, Value: {1}," kvp.Key, kvp.Value);
- Console.WriteLine(cars["FIAT"]);
- Console.WriteLine(cars["Ferrari"]);
- Console.WriteLine(cars["Trabant"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement