C# Dictionary字典使用for循环遍历

Dictionary<string, string> dict = new Dictionary<string, string>();  

for (int i = 0; i < dict.Count; i++) { (int key, string value) = dict.ElementAt(i); Console.WriteLine($"key={key},value={dict[key]}"); }

 

posted @ 2023-02-24 14:36  仲夏不凉爽  阅读(1107)  评论(0编辑  收藏  举报