C#获取多个相同name值

本来用Request.Form["txtnote"]就可以了,可是里面如果有逗号怎么办,这种方式是自动以逗号分开的。
string[] nameParts = Request.Params.GetValues("txtnote")可满足要求。
然后合并即可,可用FOR,据说foreach性能更佳。

            string a = "";
           // for( int i = 0; i < nameParts.Length; i++ )
            foreach (string s in nameParts)
            {
                //a +=nameParts[i].ToString() + "@";
                a += s + "@";
            }

posted on 2011-08-19 13:38  ★金★  阅读(306)  评论(0编辑  收藏  举报

导航