C#中累加器函数Aggregate用法实例
作者:优雅先生 时间:2023-03-21 10:28:30
本文实例讲述了C#中累加器函数Aggregate用法。分享给大家供大家参考。具体如下:
var shouldExclude = false;
var dirName = dir.Name;
foreach(var pattern in excludePatterns)
{
shouldExclude = shouldExclude || Regex.Match(dirName, pattern).Success;
}
// 使用Aggregate改写
var dirName = dir.Name;
var shouldExclude = excludePatterns.Aggregate(false, (current, pattern) => current || Regex.Match(dirName, pattern).Success);
希望本文所述对大家的C#程序设计有所帮助。
标签:C#,累加器
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
java数据结构和算法学习之汉诺塔示例
2021-09-28 14:46:18
IDEA中的.iml文件和.idea文件夹
2023-11-23 11:47:19
![](https://img.aspxhome.com/file/2023/0/59680_0s.png)
spring aop execution表达式的用法
2023-08-22 05:39:24
![](https://img.aspxhome.com/file/2023/2/88072_0s.png)
SpringMvc+Mybatis+Pagehelper分页详解
2021-08-13 14:15:11
spring-boot中使用spring-boot-devtools的实现代码
2021-10-09 13:31:32
java抓取网页或文件中的邮箱号码
2023-07-30 19:19:28
![](https://img.aspxhome.com/file/2023/9/62119_0s.jpg)
Java LinkedHashMap深入分析源码
2022-07-31 03:05:43
![](https://img.aspxhome.com/file/2023/2/62092_0s.png)
Java编程Nashorn实例代码
2022-07-30 05:28:21
Java反射概念与使用实例代码
2022-02-24 23:55:40
身份证号码验证算法深入研究和Java实现
2023-05-18 08:17:42
Java微信公众平台开发(11) 微信三大平台的关联
2022-10-15 06:55:56
![](https://img.aspxhome.com/file/2023/6/78296_0s.jpg)
基于java构造方法Vector修改元素源码分析
2023-11-25 10:54:56
![](https://img.aspxhome.com/file/2023/7/60237_0s.png)
深入浅出重构Mybatis与Spring集成的SqlSessionFactoryBean(上)
2021-12-01 18:27:49
![](https://img.aspxhome.com/file/2023/5/62085_0s.png)
详解Java反射创建对象
2022-12-10 03:52:23
![](https://img.aspxhome.com/file/2023/4/78024_0s.png)
基于servlet实现统计网页访问次数
2021-11-05 08:35:13
![](https://img.aspxhome.com/file/2023/7/82047_0s.jpg)
浅谈Java中的n种随机数产生办法
2023-12-22 10:36:29
macOS下Spring Boot开发环境搭建教程
2023-11-05 15:50:59
![](https://img.aspxhome.com/file/2023/1/85541_0s.jpg)
Unity3D运行报DllNotFoundException错误的解决方案
2021-09-13 00:22:35
![](https://img.aspxhome.com/file/2023/0/78150_0s.png)
spring-mybatis获取mapper的四种方式汇总
2023-11-23 06:24:39
![](https://img.aspxhome.com/file/2023/3/59743_0s.jpg)
关于Feign调用服务Headers传参问题
2022-10-31 01:48:24
![](https://img.aspxhome.com/file/2023/5/71025_0s.jpg)