.NET 树型递归

2024-03-06 16:58
文章标签 递归 net 树型

本文主要是介绍.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": 1,"CreateId": 2,"CreateTime": "2017-08-31T11:56:47.3020129+08:00","UpdateId": 2,"UpdateTime": "2017-08-31T11:56:47.3020129+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "fa36ade34296459b89b51738b3ec4f43","ParentGuidId": "-1","WaterPriceName": "非居民生活用水","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 2,"CreateId": 2,"CreateTime": "2017-08-31T11:58:07.4149953+08:00","UpdateId": 2,"UpdateTime": "2017-08-31T11:58:07.4149953+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "dc194593626642d49b676d2c3e0826fc","ParentGuidId": "-1","WaterPriceName": "特殊行业用水","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 3,"CreateId": 2,"CreateTime": "2017-08-31T11:58:28.4120591+08:00","UpdateId": 2,"UpdateTime": "2017-08-31T11:58:28.4120591+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "6fa0e035374740348a077798bb231415","ParentGuidId": "e9ff4856f80c4b73a8b2071001609e8e","WaterPriceName": "(一)“一户一表”抄表到户用户","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 1,"CreateId": 2,"CreateTime": "2017-08-31T14:09:38.1511004+08:00","UpdateId": 2,"UpdateTime": "2017-08-31T14:09:38.1511004+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "04925cbefc0c4a49b432e64266eb5fd4","ParentGuidId": "e9ff4856f80c4b73a8b2071001609e8e","WaterPriceName": "(二)非“一户一表”抄表到户用户","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 2,"CreateId": 2,"CreateTime": "2017-08-31T14:11:12.034984+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-08-31T15:45:28.3128379+08:00","UpdateId": 2,"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": 2,"CreateId": 2,"CreateTime": "2017-09-01T09:33:37.0705111+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-09-01T09:36:50.8644865+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-09-01T09:37:36.0155814+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-09-01T09:38:14.9451874+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-09-01T10:07:53.6392384+08:00","UpdateId": 2,"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": 1,"CreateId": 2,"CreateTime": "2017-09-01T10:30:15.9228281+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T10:30:15.9228281+08:00","StateTag": null,"IsNotTitle": false},{"GuidId": "3ec4df7081084579a05a1ad694c35dc9","ParentGuidId": "-1","WaterPriceName": "111111","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 1,"CreateId": 2,"CreateTime": "2017-09-01T10:41:02.151885+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T10:41:02.151885+08:00","StateTag": null,"IsNotTitle": false},{"GuidId": "fec9f7cfd48942979422eb1422d8ae35","ParentGuidId": "-1","WaterPriceName": "2222","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 1,"CreateId": 2,"CreateTime": "2017-09-01T11:00:18.7410547+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T11:00:18.7410547+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "8e44a8581f0047b39f47d433a6a55428","ParentGuidId": "3ec4df7081084579a05a1ad694c35dc9","WaterPriceName": "第一个大标题","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 1,"CreateId": 2,"CreateTime": "2017-09-01T11:18:56.6462613+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T11:18:56.6462613+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "bfc8bda801724367a42373d7f977f573","ParentGuidId": "3ec4df7081084579a05a1ad694c35dc9","WaterPriceName": "第二个大标题","YearWaterNumber": "","RealWaterPrice": "","DrainagePrice": "","Integrated": "","Sorting": 2,"CreateId": 2,"CreateTime": "2017-09-01T11:19:03.5742365+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T11:19:03.5742365+08:00","StateTag": null,"IsNotTitle": true},{"GuidId": "75d12b9ef6ea4b68a2040b3307412e46","ParentGuidId": "8e44a8581f0047b39f47d433a6a55428","WaterPriceName": "人员A属性","YearWaterNumber": "1","RealWaterPrice": "1","DrainagePrice": "1","Integrated": "1","Sorting": 1,"CreateId": 2,"CreateTime": "2017-09-01T11:19:21.6070599+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T11:19:21.6070599+08:00","StateTag": null,"IsNotTitle": false},{"GuidId": "f4827a920894465aab6d50efec813cdb","ParentGuidId": "8e44a8581f0047b39f47d433a6a55428","WaterPriceName": "人员B属性","YearWaterNumber": "2","RealWaterPrice": "2","DrainagePrice": "2","Integrated": "2","Sorting": 2,"CreateId": 2,"CreateTime": "2017-09-01T11:19:32.8762545+08:00","UpdateId": 2,"UpdateTime": "2017-09-01T11:19:32.8762545+08:00","StateTag": null,"IsNotTitle": false}
]
[{"guidId": "e9ff4856f80c4b73a8b2071001609e8e","parentGuidId": "-1","waterPriceName": "居民用水","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 1,"createId": 2,"createTime": "2017-08-31T11:56:47.3020129+08:00","updateId": 2,"updateTime": "2017-08-31T11:56:47.3020129+08:00","isNotTitle": true,"childWaterPrice": [{"guidId": "6fa0e035374740348a077798bb231415","parentGuidId": "e9ff4856f80c4b73a8b2071001609e8e","waterPriceName": "(一)“一户一表”抄表到户用户","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 1,"createId": 2,"createTime": "2017-08-31T14:09:38.1511004+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-09-01T09:36:50.8644865+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-09-01T09:37:36.0155814+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-09-01T09:38:14.9451874+08:00","updateId": 2,"updateTime": "2017-09-01T09:38:14.9451874+08:00","isNotTitle": false,"childWaterPrice": []}]},{"guidId": "04925cbefc0c4a49b432e64266eb5fd4","parentGuidId": "e9ff4856f80c4b73a8b2071001609e8e","waterPriceName": "(二)非“一户一表”抄表到户用户","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 2,"createId": 2,"createTime": "2017-08-31T14:11:12.034984+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-09-01T10:30:15.9228281+08:00","updateId": 2,"updateTime": "2017-09-01T10:30:15.9228281+08:00","isNotTitle": false,"childWaterPrice": []}]}]},{"guidId": "fa36ade34296459b89b51738b3ec4f43","parentGuidId": "-1","waterPriceName": "非居民生活用水","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 2,"createId": 2,"createTime": "2017-08-31T11:58:07.4149953+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-08-31T15:45:28.3128379+08:00","updateId": 2,"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": 2,"createId": 2,"createTime": "2017-09-01T09:33:37.0705111+08:00","updateId": 2,"updateTime": "2017-09-01T09:33:37.0705111+08:00","isNotTitle": false,"childWaterPrice": []}]},{"guidId": "dc194593626642d49b676d2c3e0826fc","parentGuidId": "-1","waterPriceName": "特殊行业用水","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 3,"createId": 2,"createTime": "2017-08-31T11:58:28.4120591+08:00","updateId": 2,"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": 1,"createId": 2,"createTime": "2017-09-01T10:07:53.6392384+08:00","updateId": 2,"updateTime": "2017-09-01T10:07:53.6392384+08:00","isNotTitle": false,"childWaterPrice": []}]},{"guidId": "3ec4df7081084579a05a1ad694c35dc9","parentGuidId": "-1","waterPriceName": "111111","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 1,"createId": 2,"createTime": "2017-09-01T10:41:02.151885+08:00","updateId": 2,"updateTime": "2017-09-01T10:41:02.151885+08:00","isNotTitle": false,"childWaterPrice": [{"guidId": "8e44a8581f0047b39f47d433a6a55428","parentGuidId": "3ec4df7081084579a05a1ad694c35dc9","waterPriceName": "第一个大标题","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 1,"createId": 2,"createTime": "2017-09-01T11:18:56.6462613+08:00","updateId": 2,"updateTime": "2017-09-01T11:18:56.6462613+08:00","isNotTitle": true,"childWaterPrice": [{"guidId": "75d12b9ef6ea4b68a2040b3307412e46","parentGuidId": "8e44a8581f0047b39f47d433a6a55428","waterPriceName": "人员A属性","yearWaterNumber": "1","realWaterPrice": "1","drainagePrice": "1","integrated": "1","sorting": 1,"createId": 2,"createTime": "2017-09-01T11:19:21.6070599+08:00","updateId": 2,"updateTime": "2017-09-01T11:19:21.6070599+08:00","isNotTitle": false,"childWaterPrice": []},{"guidId": "f4827a920894465aab6d50efec813cdb","parentGuidId": "8e44a8581f0047b39f47d433a6a55428","waterPriceName": "人员B属性","yearWaterNumber": "2","realWaterPrice": "2","drainagePrice": "2","integrated": "2","sorting": 2,"createId": 2,"createTime": "2017-09-01T11:19:32.8762545+08:00","updateId": 2,"updateTime": "2017-09-01T11:19:32.8762545+08:00","isNotTitle": false,"childWaterPrice": []}]},{"guidId": "bfc8bda801724367a42373d7f977f573","parentGuidId": "3ec4df7081084579a05a1ad694c35dc9","waterPriceName": "第二个大标题","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 2,"createId": 2,"createTime": "2017-09-01T11:19:03.5742365+08:00","updateId": 2,"updateTime": "2017-09-01T11:19:03.5742365+08:00","isNotTitle": true,"childWaterPrice": []}]},{"guidId": "fec9f7cfd48942979422eb1422d8ae35","parentGuidId": "-1","waterPriceName": "2222","yearWaterNumber": "","realWaterPrice": "","drainagePrice": "","integrated": "","sorting": 1,"createId": 2,"createTime": "2017-09-01T11:00:18.7410547+08:00","updateId": 2,"updateTime": "2017-09-01T11:00:18.7410547+08:00","isNotTitle": true,"childWaterPrice": []}
]

备注:

  从上到下代码块的功能解释

第一个代码块:调用方法

第二个代码块:递归循环

第三个代码块:实体类

第四个代码块:数据源(自己新建json文件,把数据放入文件中,自己写个文件读取的方法进行读取)

 List<WaterPriceTreeDto> TreeList = JsonAnalysisHelper.ReadObjectByJsonList<WaterPriceTreeDto>(Consts.WaterPrice);
读取文件中的数据

第五个代码块:返回的结果

转载于:https://www.cnblogs.com/myloveblogs/p/7472405.html

这篇关于.NET 树型递归的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/780737

相关文章

C语言函数递归实际应用举例详解

《C语言函数递归实际应用举例详解》程序调用自身的编程技巧称为递归,递归做为一种算法在程序设计语言中广泛应用,:本文主要介绍C语言函数递归实际应用举例的相关资料,文中通过代码介绍的非常详细,需要的朋... 目录前言一、递归的概念与思想二、递归的限制条件 三、递归的实际应用举例(一)求 n 的阶乘(二)顺序打印

Jackson库进行JSON 序列化时遇到了无限递归(Infinite Recursion)的问题及解决方案

《Jackson库进行JSON序列化时遇到了无限递归(InfiniteRecursion)的问题及解决方案》使用Jackson库进行JSON序列化时遇到了无限递归(InfiniteRecursi... 目录解决方案‌1. 使用 @jsonIgnore 忽略一个方向的引用2. 使用 @JsonManagedR

基于.NET编写工具类解决JSON乱码问题

《基于.NET编写工具类解决JSON乱码问题》在开发过程中,我们经常会遇到JSON数据处理的问题,尤其是在数据传输和解析过程中,很容易出现编码错误导致的乱码问题,下面我们就来编写一个.NET工具类来解... 目录问题背景核心原理工具类实现使用示例总结在开发过程中,我们经常会遇到jsON数据处理的问题,尤其是

Node.js net模块的使用示例

《Node.jsnet模块的使用示例》本文主要介绍了Node.jsnet模块的使用示例,net模块支持TCP通信,处理TCP连接和数据传输,具有一定的参考价值,感兴趣的可以了解一下... 目录简介引入 net 模块核心概念TCP (传输控制协议)Socket服务器TCP 服务器创建基本服务器服务器配置选项服

Rust中的BoxT之堆上的数据与递归类型详解

《Rust中的BoxT之堆上的数据与递归类型详解》本文介绍了Rust中的BoxT类型,包括其在堆与栈之间的内存分配,性能优势,以及如何利用BoxT来实现递归类型和处理大小未知类型,通过BoxT,Rus... 目录1. Box<T> 的基础知识1.1 堆与栈的分工1.2 性能优势2.1 递归类型的问题2.2

.NET利用C#字节流动态操作Excel文件

《.NET利用C#字节流动态操作Excel文件》在.NET开发中,通过字节流动态操作Excel文件提供了一种高效且灵活的方式处理数据,本文将演示如何在.NET平台使用C#通过字节流创建,读取,编辑及保... 目录用C#创建并保存Excel工作簿为字节流用C#通过字节流直接读取Excel文件数据用C#通过字节

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

如何在Visual Studio中调试.NET源码

今天偶然在看别人代码时,发现在他的代码里使用了Any判断List<T>是否为空。 我一般的做法是先判断是否为null,再判断Count。 看了一下Count的源码如下: 1 [__DynamicallyInvokable]2 public int Count3 {4 [__DynamicallyInvokable]5 get

2、PF-Net点云补全

2、PF-Net 点云补全 PF-Net论文链接:PF-Net PF-Net (Point Fractal Network for 3D Point Cloud Completion)是一种专门为三维点云补全设计的深度学习模型。点云补全实际上和图片补全是一个逻辑,都是采用GAN模型的思想来进行补全,在图片补全中,将部分像素点删除并且标记,然后卷积特征提取预测、判别器判别,来训练模型,生成的像

PHP实现二叉树遍历(非递归方式,栈模拟实现)

二叉树定义是这样的:一棵非空的二叉树由根结点及左、右子树这三个基本部分组成,根据节点的访问位置不同有三种遍历方式: ① NLR:前序遍历(PreorderTraversal亦称(先序遍历)) ——访问结点的操作发生在遍历其左右子树之前。 ② LNR:中序遍历(InorderTraversal) ——访问结点的操作发生在遍历其左右子树之中(间)。 ③ LRN:后序遍历(PostorderT