循环树结构

 /// <summary>
        /// 获取字段数据
        /// </summary>
        /// <param name="tree">树形集合</param>
        /// <param name="oldSortDictionary">填充对象</param>
        private static void GetFieldsData(List<ParamTreeInfo> tree, SortedDictionary<string, object> oldSortDictionary)
        {
            foreach (var o in tree)
            {
                foreach (var c in o.children)
                {
                    if (string.IsNullOrEmpty(c.itempara) && c.children.Count > 0)
                    {
                        foreach (var item in c.children)
                        {
                            if (item.level == "1" && !string.IsNullOrEmpty(item.itempara))
                            {
                                oldSortDictionary.Add(item.fieldid, item.itempara);
                            }
                        }
                    }
                }
            }
        }

 

posted @ 2020-09-22 15:11  韩梦芫  阅读(205)  评论(0编辑  收藏  举报