循环遍历字典并打印所有条目

字典中的每一对都是 KeyValuePair 的一个实例,其类型参数与 Dictionary 相同。当你使用 For Each 遍历字典时,每次迭代都会给你一个存储在字典中的键值对。

For Each kvp As KeyValuePair(Of String, String) In currentDictionary
  Console.WriteLine("{0}: {1}", kvp.Key, kvp.Value)
Next