LiXiang98

导航

 

2024年3月14日

摘要: 最近在项目中,需要将List A循环处理数据,然后将处理好的数据加入的List B中。 使用Parallel.ForEach并发处理List A时,处理好的List B中数据总是存在丢失。 通过排查直接使用ListA.ForEach,List B中数据不会丢失。 后面想到List类型是线程不安全的, 阅读全文
posted @ 2024-03-14 10:56 LiXiang98 阅读(308) 评论(0) 推荐(0)
 

2024年2月26日

摘要: 1 /// <summary> 2 /// OpenXml扩展方法 3 /// </summary> 4 public static class OpenXmlExtension 5 { 6 /// <summary> 7 /// 获取word文档的书签 8 /// </summary> 9 /// 阅读全文
posted @ 2024-02-26 16:18 LiXiang98 阅读(729) 评论(0) 推荐(0)
 

2023年12月26日

摘要: Console.WriteLine($"二分查找{BinarySearch(3,new int[21]{1,3,5,6,7,8,9,10,10,11,12,13,14,15,17,18,19,20,21,22,23})}"); Console.ReadLine(); //有序序列二分查找 stati 阅读全文
posted @ 2023-12-26 18:01 LiXiang98 阅读(11) 评论(0) 推荐(0)
 

2023年12月24日

摘要: Console.WriteLine("Hello, World!"); var list = new double[100000000]; for(int i = 0; i < 100000000; i++) { list[i] = i; } Console.WriteLine("Func1结果:" 阅读全文
posted @ 2023-12-24 19:03 LiXiang98 阅读(29) 评论(0) 推荐(0)
 
摘要: 一、写原生SQL 1.1 优点 理论上来说更可控,想怎么写就怎么写。 相对来说开发起来可能更快速 1.2 缺点 问题不好排查,可能会耗费更多时间 切换数据库,sql需要重新调整(各个数据库sql写法存在区别) 如果是数据结构中某个字段有修改,所有使用到当前数据库字段的地方都需要修改(特别是通过手写s 阅读全文
posted @ 2023-12-24 16:24 LiXiang98 阅读(803) 评论(0) 推荐(0)
 

2023年12月13日

摘要: select ID,Name, TEST = STUFF((SELECT ';'+xx FROM emps where ID=t.ID FOR XML PATH('')),1,1,'') from emps t group by ID,Name 阅读全文
posted @ 2023-12-13 11:19 LiXiang98 阅读(243) 评论(0) 推荐(0)
 

2023年12月11日

摘要: 在C#中,Parallel.ForEach是一个并行循环构造,它允许你并行地执行对集合中每个元素的操作。使用Parallel.ForEach时,你可以在循环体内使用递归或循环,但是需要注意以下几点: 线程安全:确保你的递归或循环内部的代码是线程安全的。如果你的代码访问共享资源,你需要确保适当的同步机 阅读全文
posted @ 2023-12-11 18:56 LiXiang98 阅读(732) 评论(0) 推荐(0)
 

2023年12月8日

摘要: Cross Apply 阅读全文
posted @ 2023-12-08 14:23 LiXiang98 阅读(16) 评论(0) 推荐(0)
 

2023年12月6日

摘要: Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); DoSomething(); stopWatch.Stop(); Console.WriteLine("耗时时间(毫秒):" + stopWatch.Elapsed.TotalMill 阅读全文
posted @ 2023-12-06 14:29 LiXiang98 阅读(27) 评论(0) 推荐(0)
 

2023年12月4日

摘要: 如果是直接拼接到路径上的数据,前端将数据encodeURIComponent一下 如: encodeURIComponent(item.remark ? item.remark : '') 阅读全文
posted @ 2023-12-04 14:32 LiXiang98 阅读(61) 评论(0) 推荐(0)