循环树结构
/// <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); } } } } } }