.NET 树型递归
/// <summary>
/// 获取全部水价标准模型
/// </summary>
/// <returns></returns>
public IEnumerable<WaterPriceTreeDto> GetWaterListAll()
{
//全部数据
List<WaterPriceTreeDto> TreeList = JsonAnalysisHelper.ReadObjectByJsonList<WaterPriceTreeDto>(Consts.WaterPrice);
List<WaterPriceTreeDto> listdd = CreateChildTree(TreeList, "-1");
return listdd;
}
/// <summary>
/// 递归生成子树
/// </summary>
/// <param name="TreeList"></param>
/// <param name="jt"></param>
/// <returns></returns>
public List<WaterPriceTreeDto> CreateChildTree(List<WaterPriceTreeDto> TreeList, string ppid)
{
List<WaterPriceTreeDto> nodeList = new List<WaterPriceTreeDto>();
var children = TreeList.Where(t => t.ParentGuidId == ppid).ToList();
foreach (var chl in children)
{
WaterPriceTreeDto node = new WaterPriceTreeDto()
{ CreateId = chl.CreateId,
CreateTime = chl.CreateTime,
DrainagePrice = chl.DrainagePrice,
GuidId = chl.GuidId,
Integrated = chl.Integrated,
IsNotTitle = chl.IsNotTitle,
ParentGuidId = chl.ParentGuidId,
RealWaterPrice = chl.RealWaterPrice,
Sorting = chl.Sorting,
UpdateId = chl.UpdateId,
UpdateTime = chl.UpdateTime,
WaterPriceName = chl.WaterPriceName,
YearWaterNumber = chl.YearWaterNumber,
ChildWaterPrice = CreateChildTree(TreeList, chl.GuidId)
};
nodeList.Add(node);
}
return nodeList;
}
namespace WA.Mx.Model
{
[Serializable]
[DataContract(Namespace = Consts.NAMESPACE + "/Model/Mobile")]
public class WaterPriceTreeDto
{
/// <summary>
/// 主键ID
/// </summary>
[DataMember(Name = "guidId")]
public string GuidId { get; set; }
/// <summary>
/// 父节点
/// </summary>
[DataMember(Name = "parentGuidId")]
public string ParentGuidId { get; set; }
/// <summary>
/// 名称
/// </summary>
[DataMember(Name = "waterPriceName")]
public string WaterPriceName { get; set; }
/// <summary>
///
/// </summary>
[DataMember(Name = "yearWaterNumber")]
public string YearWaterNumber { get; set; }
/// <summary>
/// 水价
/// </summary>
[DataMember(Name = "realWaterPrice")]
public string RealWaterPrice { get; set; }
/// <summary>
/// 排水价格
/// </summary>
[DataMember(Name = "drainagePrice")]
public string DrainagePrice { get; set; }
/// <summary>
/// 综合
/// </summary>
[DataMember(Name = "integrated")]
public string Integrated { get; set; }
/// <summary>
/// 排序
/// </summary>
[DataMember(Name = "sorting")]
public int Sorting { get; set; }
/// <summary>
/// 创建人
/// </summary>
[DataMember(Name = "createId")]
public int CreateId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[DataMember(Name = "createTime")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
[DataMember(Name = "updateId")]
public int UpdateId { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[DataMember(Name = "updateTime")]
public DateTime UpdateTime { get; set; }
/// <summary>
/// 是否作为为标题展示
/// </summary>
[DataMember(Name = "isNotTitle")]
public bool IsNotTitle { get; set; }
[DataMember(Name = "childWaterPrice")]
public List<WaterPriceTreeDto> ChildWaterPrice { get; set; }
}
}
[
{
"GuidId": "e9ff4856f80c4b73a8b2071001609e8e",
"ParentGuidId": "-1",
"WaterPriceName": "居民用水",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T11:56:47.3020129+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T11:56:47.3020129+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "fa36ade34296459b89b51738b3ec4f43",
"ParentGuidId": "-1",
"WaterPriceName": "非居民生活用水",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T11:58:07.4149953+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T11:58:07.4149953+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "dc194593626642d49b676d2c3e0826fc",
"ParentGuidId": "-1",
"WaterPriceName": "特殊行业用水",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T11:58:28.4120591+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T11:58:28.4120591+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "6fa0e035374740348a077798bb231415",
"ParentGuidId": "e9ff4856f80c4b73a8b2071001609e8e",
"WaterPriceName": "(一)“一户一表”抄表到户用户",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T14:09:38.1511004+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T14:09:38.1511004+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "04925cbefc0c4a49b432e64266eb5fd4",
"ParentGuidId": "e9ff4856f80c4b73a8b2071001609e8e",
"WaterPriceName": "(二)非“一户一表”抄表到户用户",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T14:11:12.034984+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T14:11:12.034984+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "21886c1b4f6c459fa3a9878c5a22145e",
"ParentGuidId": "fa36ade34296459b89b51738b3ec4f43",
"WaterPriceName": "其中一般工商企业,机关事业单位",
"YearWaterNumber": "2.3333",
"RealWaterPrice": "2.35",
"DrainagePrice": "6.25",
"Integrated": "12.5",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-08-31T15:45:28.3128379+08:00",
"UpdateId": ,
"UpdateTime": "2017-08-31T15:45:28.3128379+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "10c0899ac58b460a92a300c42e1d36b6",
"ParentGuidId": "fa36ade34296459b89b51738b3ec4f43",
"WaterPriceName": "高污染企业",
"YearWaterNumber": "3.22",
"RealWaterPrice": "2.55",
"DrainagePrice": "1.22",
"Integrated": "2.44",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T09:33:37.0705111+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T09:33:37.0705111+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "a4138d814112418dba4400784bd51f5a",
"ParentGuidId": "6fa0e035374740348a077798bb231415",
"WaterPriceName": "1.第一级水量(每户每月17立方米(含)及以下的水量)",
"YearWaterNumber": "3.56",
"RealWaterPrice": "2.35",
"DrainagePrice": "3.65",
"Integrated": "3.26",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T09:36:50.8644865+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T09:36:50.8644865+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "9bb6468fb4e541628c9eac4a7f607390",
"ParentGuidId": "6fa0e035374740348a077798bb231415",
"WaterPriceName": "2.第二级水量(每户每月17至20立方米(含)的水量)",
"YearWaterNumber": "3.215",
"RealWaterPrice": "5.24",
"DrainagePrice": "3.65",
"Integrated": "3.26",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T09:37:36.0155814+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T09:37:36.0155814+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "8397f0e00bbd46b58b346b40405dc7a5",
"ParentGuidId": "6fa0e035374740348a077798bb231415",
"WaterPriceName": "3.第三级水量(每户每月20立方米及以上的水量)",
"YearWaterNumber": "2.15",
"RealWaterPrice": "5.24",
"DrainagePrice": "3.65",
"Integrated": "3.26",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T09:38:14.9451874+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T09:38:14.9451874+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "d25b1ea36e4f408aa3b9090b29c30e5b",
"ParentGuidId": "dc194593626642d49b676d2c3e0826fc",
"WaterPriceName": "特种行业用水",
"YearWaterNumber": "7.45",
"RealWaterPrice": "5.85",
"DrainagePrice": "1.6",
"Integrated": "2.5",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T10:07:53.6392384+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T10:07:53.6392384+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "3fc1f88f815e43e2a49f30d3497d1cd4",
"ParentGuidId": "04925cbefc0c4a49b432e64266eb5fd4",
"WaterPriceName": "(二)非“一户一表”抄表到户用户",
"YearWaterNumber": "2.5",
"RealWaterPrice": "3.5",
"DrainagePrice": "4.58",
"Integrated": "8.5",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T10:30:15.9228281+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T10:30:15.9228281+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "3ec4df7081084579a05a1ad694c35dc9",
"ParentGuidId": "-1",
"WaterPriceName": "",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T10:41:02.151885+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T10:41:02.151885+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "fec9f7cfd48942979422eb1422d8ae35",
"ParentGuidId": "-1",
"WaterPriceName": "",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T11:00:18.7410547+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T11:00:18.7410547+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "8e44a8581f0047b39f47d433a6a55428",
"ParentGuidId": "3ec4df7081084579a05a1ad694c35dc9",
"WaterPriceName": "第一个大标题",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T11:18:56.6462613+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T11:18:56.6462613+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "bfc8bda801724367a42373d7f977f573",
"ParentGuidId": "3ec4df7081084579a05a1ad694c35dc9",
"WaterPriceName": "第二个大标题",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T11:19:03.5742365+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T11:19:03.5742365+08:00",
"StateTag": null,
"IsNotTitle": true
},
{
"GuidId": "75d12b9ef6ea4b68a2040b3307412e46",
"ParentGuidId": "8e44a8581f0047b39f47d433a6a55428",
"WaterPriceName": "人员A属性",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T11:19:21.6070599+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T11:19:21.6070599+08:00",
"StateTag": null,
"IsNotTitle": false
},
{
"GuidId": "f4827a920894465aab6d50efec813cdb",
"ParentGuidId": "8e44a8581f0047b39f47d433a6a55428",
"WaterPriceName": "人员B属性",
"YearWaterNumber": "",
"RealWaterPrice": "",
"DrainagePrice": "",
"Integrated": "",
"Sorting": ,
"CreateId": ,
"CreateTime": "2017-09-01T11:19:32.8762545+08:00",
"UpdateId": ,
"UpdateTime": "2017-09-01T11:19:32.8762545+08:00",
"StateTag": null,
"IsNotTitle": false
}
]
[
{
"guidId": "e9ff4856f80c4b73a8b2071001609e8e",
"parentGuidId": "-1",
"waterPriceName": "居民用水",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T11:56:47.3020129+08:00",
"updateId": ,
"updateTime": "2017-08-31T11:56:47.3020129+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "6fa0e035374740348a077798bb231415",
"parentGuidId": "e9ff4856f80c4b73a8b2071001609e8e",
"waterPriceName": "(一)“一户一表”抄表到户用户",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T14:09:38.1511004+08:00",
"updateId": ,
"updateTime": "2017-08-31T14:09:38.1511004+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "a4138d814112418dba4400784bd51f5a",
"parentGuidId": "6fa0e035374740348a077798bb231415",
"waterPriceName": "1.第一级水量(每户每月17立方米(含)及以下的水量)",
"yearWaterNumber": "3.56",
"realWaterPrice": "2.35",
"drainagePrice": "3.65",
"integrated": "3.26",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T09:36:50.8644865+08:00",
"updateId": ,
"updateTime": "2017-09-01T09:36:50.8644865+08:00",
"isNotTitle": false,
"childWaterPrice": []
},
{
"guidId": "9bb6468fb4e541628c9eac4a7f607390",
"parentGuidId": "6fa0e035374740348a077798bb231415",
"waterPriceName": "2.第二级水量(每户每月17至20立方米(含)的水量)",
"yearWaterNumber": "3.215",
"realWaterPrice": "5.24",
"drainagePrice": "3.65",
"integrated": "3.26",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T09:37:36.0155814+08:00",
"updateId": ,
"updateTime": "2017-09-01T09:37:36.0155814+08:00",
"isNotTitle": false,
"childWaterPrice": []
},
{
"guidId": "8397f0e00bbd46b58b346b40405dc7a5",
"parentGuidId": "6fa0e035374740348a077798bb231415",
"waterPriceName": "3.第三级水量(每户每月20立方米及以上的水量)",
"yearWaterNumber": "2.15",
"realWaterPrice": "5.24",
"drainagePrice": "3.65",
"integrated": "3.26",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T09:38:14.9451874+08:00",
"updateId": ,
"updateTime": "2017-09-01T09:38:14.9451874+08:00",
"isNotTitle": false,
"childWaterPrice": []
}
]
},
{
"guidId": "04925cbefc0c4a49b432e64266eb5fd4",
"parentGuidId": "e9ff4856f80c4b73a8b2071001609e8e",
"waterPriceName": "(二)非“一户一表”抄表到户用户",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T14:11:12.034984+08:00",
"updateId": ,
"updateTime": "2017-08-31T14:11:12.034984+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "3fc1f88f815e43e2a49f30d3497d1cd4",
"parentGuidId": "04925cbefc0c4a49b432e64266eb5fd4",
"waterPriceName": "(二)非“一户一表”抄表到户用户",
"yearWaterNumber": "2.5",
"realWaterPrice": "3.5",
"drainagePrice": "4.58",
"integrated": "8.5",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T10:30:15.9228281+08:00",
"updateId": ,
"updateTime": "2017-09-01T10:30:15.9228281+08:00",
"isNotTitle": false,
"childWaterPrice": []
}
]
}
]
},
{
"guidId": "fa36ade34296459b89b51738b3ec4f43",
"parentGuidId": "-1",
"waterPriceName": "非居民生活用水",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T11:58:07.4149953+08:00",
"updateId": ,
"updateTime": "2017-08-31T11:58:07.4149953+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "21886c1b4f6c459fa3a9878c5a22145e",
"parentGuidId": "fa36ade34296459b89b51738b3ec4f43",
"waterPriceName": "其中一般工商企业,机关事业单位",
"yearWaterNumber": "2.3333",
"realWaterPrice": "2.35",
"drainagePrice": "6.25",
"integrated": "12.5",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T15:45:28.3128379+08:00",
"updateId": ,
"updateTime": "2017-08-31T15:45:28.3128379+08:00",
"isNotTitle": false,
"childWaterPrice": []
},
{
"guidId": "10c0899ac58b460a92a300c42e1d36b6",
"parentGuidId": "fa36ade34296459b89b51738b3ec4f43",
"waterPriceName": "高污染企业",
"yearWaterNumber": "3.22",
"realWaterPrice": "2.55",
"drainagePrice": "1.22",
"integrated": "2.44",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T09:33:37.0705111+08:00",
"updateId": ,
"updateTime": "2017-09-01T09:33:37.0705111+08:00",
"isNotTitle": false,
"childWaterPrice": []
}
]
},
{
"guidId": "dc194593626642d49b676d2c3e0826fc",
"parentGuidId": "-1",
"waterPriceName": "特殊行业用水",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-08-31T11:58:28.4120591+08:00",
"updateId": ,
"updateTime": "2017-08-31T11:58:28.4120591+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "d25b1ea36e4f408aa3b9090b29c30e5b",
"parentGuidId": "dc194593626642d49b676d2c3e0826fc",
"waterPriceName": "特种行业用水",
"yearWaterNumber": "7.45",
"realWaterPrice": "5.85",
"drainagePrice": "1.6",
"integrated": "2.5",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T10:07:53.6392384+08:00",
"updateId": ,
"updateTime": "2017-09-01T10:07:53.6392384+08:00",
"isNotTitle": false,
"childWaterPrice": []
}
]
},
{
"guidId": "3ec4df7081084579a05a1ad694c35dc9",
"parentGuidId": "-1",
"waterPriceName": "",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T10:41:02.151885+08:00",
"updateId": ,
"updateTime": "2017-09-01T10:41:02.151885+08:00",
"isNotTitle": false,
"childWaterPrice": [
{
"guidId": "8e44a8581f0047b39f47d433a6a55428",
"parentGuidId": "3ec4df7081084579a05a1ad694c35dc9",
"waterPriceName": "第一个大标题",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T11:18:56.6462613+08:00",
"updateId": ,
"updateTime": "2017-09-01T11:18:56.6462613+08:00",
"isNotTitle": true,
"childWaterPrice": [
{
"guidId": "75d12b9ef6ea4b68a2040b3307412e46",
"parentGuidId": "8e44a8581f0047b39f47d433a6a55428",
"waterPriceName": "人员A属性",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T11:19:21.6070599+08:00",
"updateId": ,
"updateTime": "2017-09-01T11:19:21.6070599+08:00",
"isNotTitle": false,
"childWaterPrice": []
},
{
"guidId": "f4827a920894465aab6d50efec813cdb",
"parentGuidId": "8e44a8581f0047b39f47d433a6a55428",
"waterPriceName": "人员B属性",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T11:19:32.8762545+08:00",
"updateId": ,
"updateTime": "2017-09-01T11:19:32.8762545+08:00",
"isNotTitle": false,
"childWaterPrice": []
}
]
},
{
"guidId": "bfc8bda801724367a42373d7f977f573",
"parentGuidId": "3ec4df7081084579a05a1ad694c35dc9",
"waterPriceName": "第二个大标题",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T11:19:03.5742365+08:00",
"updateId": ,
"updateTime": "2017-09-01T11:19:03.5742365+08:00",
"isNotTitle": true,
"childWaterPrice": []
}
]
},
{
"guidId": "fec9f7cfd48942979422eb1422d8ae35",
"parentGuidId": "-1",
"waterPriceName": "",
"yearWaterNumber": "",
"realWaterPrice": "",
"drainagePrice": "",
"integrated": "",
"sorting": ,
"createId": ,
"createTime": "2017-09-01T11:00:18.7410547+08:00",
"updateId": ,
"updateTime": "2017-09-01T11:00:18.7410547+08:00",
"isNotTitle": true,
"childWaterPrice": []
}
]
备注:
从上到下代码块的功能解释
第一个代码块:调用方法
第二个代码块:递归循环
第三个代码块:实体类
第四个代码块:数据源(自己新建json文件,把数据放入文件中,自己写个文件读取的方法进行读取)
List<WaterPriceTreeDto> TreeList = JsonAnalysisHelper.ReadObjectByJsonList<WaterPriceTreeDto>(Consts.WaterPrice);
读取文件中的数据
第五个代码块:返回的结果
.NET 树型递归的更多相关文章
- vuejs学习--递归组件(树型表格分享)
前言 学习vue有一段时间了,最近使用vue做了一套后台管理系统,其中使用最多就是递归组件,也因为自己对官方文档的不熟悉使得自己踩了不少坑,今天写出来和大家一起分享. 递归组件 组件在它的模板内可以递 ...
- SQL递归获取树型路径中文名称
项目中遇到一个树型结构表要根据任意传入节点获取它从根节点一直到自身节点的全部路径的中文名称,并且用'>'与分隔. 我使用在sqlServer中写了一个解析函数方便开发调用. USE [RP_ER ...
- JavaScript:使用递归构建树型菜单
使用递归函数将扁平数据转为树型结构,并渲染到页面 效果图: 代码: <!DOCTYPE html> <html lang="en"> <head> ...
- Rafy 领域实体框架 - 树型实体功能(自关联表)
在 Rafy 领域实体框架中,对自关联的实体结构做了特殊的处理,下面对这一功能进行讲解. 场景 在开发数据库应用程序时,往往会遇到自关联表的场景.例如,分类信息.组织架构中的部门.文件夹信息等,都 ...
- 树型动态规划(树形dp)
树型动态规划就是在“树”的数据结构上的动态规划,树型动态规划是建立在树上的,所以有二个方向: 1.根—>叶:这种题目基本上碰不到 2.叶->根:根的子节点传递有用的信息给根,完后根得出最优 ...
- POJ 2152 fire / SCU 2977 fire(树型动态规划)
POJ 2152 fire / SCU 2977 fire(树型动态规划) Description Country Z has N cities, which are numbered from 1 ...
- CJOJ 1010【NOIP2003】加分二叉树 / Luogu 1040 加分二叉树(树型动态规划)
CJOJ 1010[NOIP2003]加分二叉树 / Luogu 1040 加分二叉树(树型动态规划) Description 设 一个 n 个节点的二叉树 tree 的中序遍历为( 1,2,3,-, ...
- 路径字符串数据转化为树型层级对象,path to json tree
由于项目中使用了react 及 ant-design ,在使用tree树型控件时,需要 类似下面的数据, const treeData = [{ title: '0-0', key: '0-0', c ...
- Vue.js示例:树型视图; 模式组件;
树型图 本示例是一个简单的树形视图实现,它展现了组件的递归使用. mycode pen:https://codepen.io/chentianwei411/pen/KGKQxE 重点:递归是如何形成的 ...
随机推荐
- python3 速查参考- python基础 8 -> 面向对象基础:类的创建与基础使用,类属性,property、类方法、静态方法、常用知识点概念(封装、继承等等见下一章)
基础概念 1.速查笔记: #-- 最普通的类 class C1(C2, C3): spam = 42 # 数据属性 def __init__(self, name): # 函数属性:构造函数 self ...
- Lua易忘点
仅针对自己 __index的理解 __index是:当我们访问一个表中的元素不存在时,则会触发去寻找__index元方法,如果不存在,则返回nil,如果存在,则返回结果 Window = {} Win ...
- 【miscellaneous】多播(组播)原理分析
为什么要使用多播: 网卡从网络上接收到目标物理地址对应的所有bit位都为1的数据报时,会收到这条消息并将其上传给驱动程序,网卡的这种工作模式称为广播模式,网卡的缺省工作模式包含直接模式和 ...
- 深入理解C语言-结构体做函数参数
结构体做函数参数,在C语言中属于常见现象,此时为了内存考虑,不传递结构体,而是传递结构体的地址 结构体定义 struct Man { char name[64]; int age; }; 结构体可以与 ...
- IDEA 2019.2破解激活教程(激活到2089年8月,亲测有效,持续更新中...)
本来笔者这边是有个正版激活码可以使用的,但是,2019.9月3号的时候,一些小伙伴反映这个注册码已经失效了,于是拿着自己的 IDEA, 赶快测试了一下,果不其然,已然是不能用了. 好在,笔者又找到了新 ...
- 菜鸟系列Fabric——Fabric 私密数据(6)
Fabric 私密数据 1.私密数据的定义 如果某个渠道上的一组组织需要将数据与该渠道上的其他组织保密,他们可以选择创建一个仅包含需要访问数据的组织的新渠道.但是,在每种情况下创建单独的通道会产生额外 ...
- vi去掉^M
Windows下编辑的文本文件or程序文件,拷贝到linux下,用vi打开时,有时候会看到每行末尾有个 ^M 的符号. 这里介绍一个可以快速去除^M符号的方法: 用vi编辑器打开该文件,然后输入: : ...
- nginx 报错:[crit] 12456#0: *5 SSL_do_handshake() failed (SSL: error:1408A0A0:SSL routines:SSL3_GET_CLIENT_HELLO
解决方法: 将配置 listen ssl; 更换为: listen ; ssl on; 从版本1.15.0开始,ssl on; 指令被废弃,使用 listen 443 ssl; 代替. 具体查看官网: ...
- Yii源码分享-底层+view层1
文件:https://files.cnblogs.com/files/cwlife/YII%E7%BB%A7%E6%89%BF%E6%A0%91.xmind.zip 视屏:https://v.qq.c ...
- k8s-kubectl命令大全
Kubectl命令行管理对象 类型 命令 描述 基础命令 create 通过文件名或标准输入创建资源. expose 将一个资源公开为一个新的Kubernetes服务. run 创建并运行一个特定的镜 ...