首页 > 其他 > 详细

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

时间:2014-10-08 12:30:35      阅读:295      评论:0      收藏:0      [点我收藏+]

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/>";
            }
        }

 

 

前台图片:

bubuko.com,布布扣

 

后台展示:

bubuko.com,布布扣

 

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

原文:http://www.cnblogs.com/zhanglimei/p/4010837.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!