using System;
using System.Collections.Generic;
class Program
{
static void Main() {
Dictionary<string, int> dict = new Dictionary<string, int>();
dict["csharp"] = 1;
dict["c"] = 4;
dict["java"] = 6;
dict.Add("python", 9);
Console.WriteLine("key values:");
foreach (KeyValuePair<string, int> kvp in dict) {
Console.WriteLine(kvp.Key + " - " + kvp.Value);
}
Console.WriteLine("\nkeys:");
foreach (string key in dict.Keys) {
Console.WriteLine(key);
}
Console.WriteLine("\nvalues:");
foreach (int val in dict.Values) {
Console.WriteLine(val.ToString());
}
}
}
/*
run:
key values:
csharp - 1
c - 4
java - 6
python - 9
keys:
csharp
c
java
python
values:
1
4
6
9
*/