Dictionary

 

            Dictionary<string, ExtendColGroup> extendcolgroup = new Dictionary<string, ExtendColGroup>();
            foreach (var item in cols)
            {
                if (extendcolgroup.ContainsKey(item.ExtendColGroupName))
                {
                    ExtendColGroup colItem = extendcolgroup[item.ExtendColGroupName];
                    colItem.Count++;
                    colItem.Items.Add(item);
                }
                else
                {
                    var colItem = new ExtendColGroup() { Items = new List<V_Sys_Customer>(), ExtendColGroupName = item.ExtendColGroupName };
                    colItem.Count = 1;
                    colItem.Items.Add(item);
                    extendcolgroup.Add(item.ExtendColGroupName, colItem);

                }
            }
            ViewData["extendcolgroup"] = extendcolgroup;



            cols.Add(new V_Sys_Customer() { ExtendColName = "afas", ExtendColValue = "sdfas" });
            cols.Add(new V_Sys_Customer() { ExtendColName = "sdf", ExtendColValue = "asdfadsf" });
            cols.Add(new V_Sys_Customer() { ExtendColName = "trge", ExtendColValue = "asdfdasf" });
            cols.Add(new V_Sys_Customer() { ExtendColName = "34", ExtendColValue = "asdfasdf" });
            cols.Add(new V_Sys_Customer() { ExtendColName = "asdas爱的", ExtendColValue = "asdfasdf" });
            ViewData["cols"] = cols;

 

posted @ 2015-03-26 11:09  dekevin  阅读(258)  评论(0编辑  收藏  举报