码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-10-08 13:52:25      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   for   sp   2014   c   on   

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的键和值

标签:blog   http   io   ar   for   sp   2014   c   on   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!