protected void Button1_Click ( object sender, EventArgs e )
        {
            Dictionary<string, string> DicTest = new Dictionary<string, string>();
            DicTest.Add( "a", "1" );
            DicTest.Add( "b", "2" );
            DicTest.Add( "c", "3" );
            DicTest.Add( "d", "4" );
            DicTest.Add( "e", "5" );
            DicTest.Add( "f", "6" );

            for(int i = 0 ; i < DicTest.Count ; i++)
            {
                Literal1.Text += DicTest.ToList()[i].Key + ":" + DicTest.ToList()[i].Value+ "<br/>";
            }
        }

 

 

前台图片:

c# for循环获取dictionary的键和值

 

后台展示:

c# for循环获取dictionary的键和值

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-01-18
猜你喜欢
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案