C# for循环遍历字典里面的所有元素

using System.Linq;//添加引用
using System;
 [ContextMenu("DebugTest")]
    public void MoviePlay()
    {
        Dictionary<string, string> TestDic=new Dictionary<string, string> ();
        TestDic.Add("0","00");
        TestDic.Add("1", "01");
        TestDic.Add("2", "02");
        TestDic.Add("3", "03");
        TestDic.Add("4", "04");
        TestDic.Add("5", "05");
        for (int i = Convert.ToInt32(TestDic.Keys.First().ToString()); i < TestDic.Keys.Count + Convert.ToInt32(TestDic.Keys.First().ToString()); i++)
        {
            Debug.Log(i+ TestDic[i.ToString()]);
        }
    }

C# for循环遍历字典里面的所有元素_第1张图片
C# for循环遍历字典里面的所有元素_第2张图片

你可能感兴趣的:(杂项)